data validatie in userform
Posted by WangYa on December 24, 2001 9:09 PM
How can I make sure that valid data is entered in a textbox in a userform.
Colo gave the suggestion below and that works but still it is possible to enter wrong data such as a row of ,,,,, and numbers like 1,12,345 as well the + and still work resulting in wrong data. Any good ideas?
Private Sub TextBox1_Change()
'///Please Paste UserForm Module
If IsNumeric(TextBox1.Value) = False Then
Application.EnableEvents = False
MsgBox "Only numbers please!", vbCritical
TextBox1.Value = Left(TextBox1.Value, Len(TextBox1.Value) - 1)
Application.EnableEvents = True
End If
End Sub