Application.Inputbox question

N

Nemo

Hi All -

Using an application.inputbox for numbers, and I understand Cancel =
FALSE, and FALSE = zero.

I need zero to be an acceptable number. How do I separate the FALSE from
the zero?

Thanks in advance.
....Capt. Nemo
 
D

Dave Peterson

One way:

Option Explicit
Sub testme()
Dim resp As Variant
resp = Application.InputBox(Prompt:="Number", Type:=1)

If CStr(resp) = "False" Then
MsgBox "Cancel"
Else
MsgBox resp
End If
End Sub
 
C

Captain Nemo

Dave Peterson said:
One way:

Option Explicit
Sub testme()
Dim resp As Variant
resp = Application.InputBox(Prompt:="Number", Type:=1)

If CStr(resp) = "False" Then
MsgBox "Cancel"
Else
MsgBox resp
End If
End Sub

Hi Dave -

Got it. Thanks.

....best, Capt. N.
 
Top