Trapping Errors from an InputBox

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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

Similar Threads

InputBox 3
InputBox 3
Cannot trap 2501 error 5
Input Box into Make Table Query 6
Validation on InputBox() 5
InputBox 1
InputBox() 1
Check for valid date on input box 2

Back
Top