spurs
Active Member
- Joined
- Oct 18, 2006
- Messages
- 479
- Office Version
- 2016
- 2013
- 2010
- 2007
- 2003 or older
- Platform
- Windows
I am trying to create an input box (or something like it)
InputBox has 2 buttons ok and cancel. I don't need the cancel but someone could press it.
I have an error handler in case the numerical value entered is out of range.
d is an initial value
In my code below if cancel is pressed during input it seems that false is not returned as i get the Mesage Box "Error- The selected " & dy & " mm diameter is not in range." returned instead
How can I fix this?
Sub Test
On Error GoTo errHandler
dy = InputBox("Enter a Diameter of Interest", "Parameters", d)
errHandler:
If dy = "False" Then Exit Sub
MsgBox "Error- The selected " & dy & " mm diameter is not in range.", vbOKOnly
Exit Sub
Resume
Exit Sub
InputBox has 2 buttons ok and cancel. I don't need the cancel but someone could press it.
I have an error handler in case the numerical value entered is out of range.
d is an initial value
In my code below if cancel is pressed during input it seems that false is not returned as i get the Mesage Box "Error- The selected " & dy & " mm diameter is not in range." returned instead
How can I fix this?
Sub Test
On Error GoTo errHandler
dy = InputBox("Enter a Diameter of Interest", "Parameters", d)
errHandler:
If dy = "False" Then Exit Sub
MsgBox "Error- The selected " & dy & " mm diameter is not in range.", vbOKOnly
Exit Sub
Resume
Exit Sub