Sub GetNumber
Dim myNum As Variant
On Error Resume Next 'This line seems to have no effect.
myNum = Application.InputBox(Prompt:="Enter a number", Type:=1)
'.............................new
coding................................
if myNum = "" then
msgbox "Please enter a number in the input box."
exit sub
end if
'.............................................................................
'If user enters nothing and clicks OK, Excel generates an info box
about
'entering an incorrect formula. But it is NOT a VBA error so
cannot be
trapped
'with normal methods.
If myNum = False Then
MsgBox ("Cancel was chosen. Macro will end.")
Exit Sub
Else
MsgBox (myNum)
End If
End Sub
try that.

susan
On Nov 6, 10:48*am, ArthurJ <Arth...@discussions.microsoft.com> wrote:
> I want the user to input a number. I want to handle the three possible
> situations:
> 1. User enters number
> 2. User clicks Cancel
> 3. User enters nothing and clicks OK
>
> I am having trouble with the third possibility, where the user enters nothing.
>
> Below is some of the code I have now:
>
> Sub GetNumber
> * * Dim myNum As Variant
> * * On Error Resume Next * *'This line seems to have no effect.
> * * myNum = Application.InputBox(Prompt:="Enter a number", Type:=1)
> * * 'If user enters nothing and clicks OK, Excel generates an info box about
> * * 'entering an incorrect formula. But it is NOT a VBA error so cannot be
> trapped
> * * 'with normal methods.
>
> * * If myNum = False Then
> * * * * MsgBox ("Cancel was chosen. Macro will end.")
> * * * * Exit Sub
> * * Else
> * * * * MsgBox (myNum)
> * * End If
> End Sub
>
> Thank you,
> Art