Inputbox problem

R

Rolf Rosenquist

From an inputbox the user can write a new price. The box has two buttons, Ok
and Cancel. But if he hits the Cancel nothing happens. The inputbox is still
there and the sub won't exit. My code is

GetPrice:
Price = InputBox("New price:", "Pricelist")
If Price = vbCancel Then
Exit Sub
End If
If Not IsNumeric(Price) Then
GoTo GetPrice
End If

Anyone know how to detect the Cancel button?
/ Rolf
 
G

Guest

Try this
GetPrice:
Price = InputBox("New price:", "Pricelist")
If Price = "" Then
Exit Sub
End If
If Not IsNumeric(Price) Then
GoTo GetPrice
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top