Thread: vbCancel
View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default vbCancel

Sub test()

Dim vNumber
Dim dNumber As Double

vNumber = Application.InputBox(Prompt:="Put a number in the box",
Type:=1)

If vNumber = "False" Then
Exit Sub
Else
dNumber = Val(vNumber)
MsgBox dNumber
End If

End Sub


RBS


"Mike" wrote in message
...
On an inputbox, I am asking the user to enter a number, and there is an OK
and a Cancel. I want it to exit the sub if the user hits Cancel, even if
he
has already typed something in the box.