FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,368
- Office Version
- 365
- 2016
- Platform
- Windows
I'm missing something here. I want the user to enter a number. If they don't enter a number, but instead they enter text, they get "Number is not valid" and the value entered is highlighted for the user to try again.
If they select cancel they would get
If they select cancel they would get
"You did not enter a number. Please try again and enter a number". How do I capture if they select Ok and nothing entered?
Also, I'm running this thru a Button (Form Control) on the spreadsheet, but even with the VBE closed, the msgbox does not popup immediately. I have to click on the Excel icon on my taskbar to get the msgbox. I've never seen this before. What am I missing?
Also, I'm running this thru a Button (Form Control) on the spreadsheet, but even with the VBE closed, the msgbox does not popup immediately. I have to click on the Excel icon on my taskbar to get the msgbox. I've never seen this before. What am I missing?
Code:
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub CreateInputBoxMethodDataType()
Dim myNumberResponse As Variant
myNumberResponse = Application.InputBox(Prompt:="Enter a number", Type:=1)
If myNumberResponse = False Then
MsgBox "You did not enter a number. Please try again and enter a number"
End If
Exit Sub
End Sub[/FONT]