vbCancel
According to help:
If the user clicks OK or presses ENTER , the InputBox function returns
whatever is in the text box. If the user clicks Cancel, the function returns
a zero-length string ("").
you must have Ans dim'd as a number.
--
Regards,
Tom Ogilvy
wrote in message
...
When I hit Cancel (or X) on an InputBox, I get the returned value of 0
(Zero).
If Ans = 0 Then Exit Sub
Tested using Excel 97SR2 on Windows 98SE,
HTH
Paul
--------------------------------------------------------------------------
------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------
------------------------------------
Greetings !
I have an InputBox.
How do I distinguish between a valid input value of 2 and
the user clicking on the "Cancel" button ?
This worked just FINE - until I entered a value of 2 !
Ans = InputBox( _
"Enter a value between 1 and 5, myTitle, TP)
If Ans = vbCancel Then Exit Sub
TP = Ans
|