ok i have a textbox say textbox1.text and i want to make sure when a non numeric value is entered it exits sub or does nothing.. thanks
non numeric textbox manipulation
Collapse
X
-
This is the code from a call in Bytes:
Only integers can be entered (can be optional for your project)
The first lines lets only numbers be entered !
Code:Private Sub Text1_Change() With Text1 '§ check for letters If Not IsNumeric(.Text) And (.Text) <> "" Then MsgBox ("Enter a NUMBER !") '§ clear the last character .Text = Left(.Text, Len(.Text) - 1) '§ set the cursor at the end of the string .SelStart = Len(.Text) Else '§ check for DOT or COMMA If InStr(.Text, ".") Or InStr(.Text, ",") Then MsgBox ("Enter an INTEGER value !") Else '§ enter your code.... ' MsgBox ("This is OK") End If End If End With End SubComment
Comment