ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.Inputbox question (https://www.excelbanter.com/excel-programming/417717-application-inputbox-question.html)

Nemo[_3_]

Application.Inputbox question
 
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

Dave Peterson

Application.Inputbox question
 
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



Nemo wrote:

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


--

Dave Peterson

Captain Nemo[_2_]

Application.Inputbox question
 
In article ,
Dave Peterson wrote:

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.


All times are GMT +1. The time now is 12:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com