View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ozgrid.com ozgrid.com is offline
external usenet poster
 
Posts: 464
Default VBA data validation

Use;

Private Sub TextBox1_Change()
If TextBox1 = vbNullString Then Exit Sub

If Not IsNumeric(TextBox1) Then
MsgBox "6 digit numbers only"
TextBox1 = vbNullString
End If
End Sub

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1 = vbNullString Then Exit Sub

If Len(TextBox1) < 6 Then
MsgBox "6 digit numbers only"
Cancel = True
TextBox1 = vbNullString
End If
End Sub



--
Regards
Dave Hawley
www.ozgrid.com
"KK" wrote in message
...
Hi all,
I have created a textbox input on a userform. I would like to input
the postal code here and would like to dala validate it for a 6
numeric input. Is ther a way to do this