Trapping Errors from an InputBox

J

Jerry Mc Cauley

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
 
O

Ofer Cohen

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
 
Top