Application.Inputbox question

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

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

Back
Top