View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Input box with a loop

Hi,

A look at your code would have been helpful but here's one way

Sub liminal()
retry:
response = InputBox("What is the meaning of Life?")
If response < 42 Then
response1 = MsgBox("Now that's incorrect, please re-read the book",
vbRetryCancel)
If response1 = vbRetry Then GoTo retry
Else
MsgBox "Well done, the meaning of life is " & response
End If
End Sub

Mike

"aimee209" wrote:

I have an input box that pops up and asks a question. If the user enters the
correct answer, a message box will show saying that's correct, and after
clicking ok move on to the next question.
Right now, when the user enters the wrong answer, a message box saying
that's incorrect shows, but then it moves on to the next question when ok is
clicked. Is there a way to do a loop so that when the incorrect answer is
selected, the original question reappears instead of going to the next
question?

Thanks!