Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Verify InputBox answer 1

Status
Not open for further replies.

vandaliarental

Technical User
Jul 17, 2000
84
US
I know this is a simple question, but I just can't figure out the best way to do it.

I have an InputBox prompting the user to enter a choice:

str = InputBox("Choose (A) or (B)"),"Choice","A")

I want to verify they enter either A or B, and if they enter anything else, I'd like to loop back to the question & not let them by until they pick one of the choices listed.

Any ideas?

Thanks,
Connie
Vandalia Rental
 
Dim str As String
str = ""
Do Until UCase(str) = "A" Or UCase(str) = "B"
str = InputBox("Choose (A) or (B)", "Choice", "A")
Loop
msgbox str
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top