-
Solved: MsgBox Loop Help
I have something like this
[vba]res = InputBox("Please Enter Password")
If res = "candy" Then[/vba]
It will run a couple of formulas.
I would like so if res doesn't = "candy" then to prompt res2 = MsgBox(""Sorry wrong Answer! Please Try Again!", vbYesNo)
And if clicked Yes loop back to the original res InputBox.
If clicked No To Exit Sub.
Any help would be great. Thanks
-
Try this:
[VBA]
Sub res()
Dim res As String
Strt:
res = InputBox("Please Enter Password")
If res = "candy" Then
MsgBox "Success"
ElseIf res <> "candy" Then
res2 = MsgBox("Sorry wrong Answer! Please Try Again!", vbYesNo)
If res2 = vbYes Then
GoTo Strt
Else
Exit Sub
End If
End If
End Sub
[/VBA]
-
Perfect!
One more thing do you know how i can have the text entered in the InputBox appear as asterisks? "*****"
-
Nope! you need to use a userform and textbox if you are planning on using it for a password!
-
Ok thanks i will use it like that. Thanks Simon