putting validation to TextBox in the userform

S

salihyil

hello guys

i use userform to autofilter the data from the list. when i put the
username it just filters the usernames details.

Question:
does anyone know how to put validation to textbox. eg just letters. if
end-user puts number, i want system to show an error message.

and also if the text that will be put in textbox does not exist in
(data,list)i want system to show error messege.

if you can help i will appriciate guys

thanks
:) :(
 
S

Serkan

Here's the code you'll need...

Private Sub TextBox1_Change()
If TextBox1 = vbNullString Then Exit Sub
If IsNumeric(TextBox1) Then
MsgBox "Sorry, text only"
TextBox1 = vbNullString
End If
End Sub
 
Top