I'm using the following code to get a numeric value and exit if Cancel is clicked.
However, when OK is clicked with no input an error is displayed that says "The formula you typed contains an error." etc... I want to eliminate this message and test for a Null value. However, the following tests have not worked.
I've also tried...
But this does not work.
Does anyone know how to test for a Null entry?
Code:
Sub Get_Number()
Dim vValue
vValue = Application.InputBox(Prompt:="Enter a Number", Type:=1)
If vValue = False Then Exit Sub 'Cancel was clicked
End Sub
However, when OK is clicked with no input an error is displayed that says "The formula you typed contains an error." etc... I want to eliminate this message and test for a Null value. However, the following tests have not worked.
Code:
If vValue = "" Then Exit Sub
If vValue = vbNull Then Exit Sub
I've also tried...
Code:
On Error GoTo Cancelled 'placed prior to the Application.InputBox
'with...
Cancelled:
Exit Sub
But this does not work.
Does anyone know how to test for a Null entry?