Trapping Errors from an InputBox

G

Guest

Good evening all ...

I know there as to be a way ... but I have not had any luck.

I have an inputbox that works great if your selection within the indicated
number ... but lots of times, you get bit by the "number lock" issue and the
program haults with Run-time error '13': Type mismatch. Is there a way to
"trap" this error and return to the inputbox without blowing up?

Thanks in advance
 
G

Guest

Try something like

Dim MyNum as Variant, I as Boolean
I = False
' Loop until number is entered
While Not I = True
MyNum=InputBox("Please select a number")
' Check if it a number
If IsNumeric(MyNum) Then
I = True
Else
Msgbox "Must select a number"
End If
Wend
 

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