A very simple way to require numbers only in a text box.
A very simple way to require numbers only in a text box.
Rate A very simple way to require numbers only in a text box.
(1(1 Vote))
'Making sure user enter a number 15 thur 600
Dim TestInput As Integer 'Will set for numbers only
On Error GoTo Inputwrong 'On error will goto a message.
TestInput = txtCmdMin.Text
If TestInput < 15 Or TestInput > 600 Then
MsgBox "Invalid number, Please re-enter a number 15 thru 600!", , "Your title"
txtCmdMin.SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
Inputwrong: 'If the user input was anything but a number this will display.
If Err.Number = 13 Then
MsgBox "Invalid number, Please re-enter a number 15 thru 600!", , "Your title"
txtCmdMin.SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
End Sub
A very simple way to require numbers only in a text box. Comments
No comments yet — be the first to post one!
Post a Comment