You can validate upon triggering the exit event for the textbox. You could even pre-fill the text with whatever the proper form for the field is (e.g. 000000) and use the change event to adjust the field after each key entry. Exactly how depends on your application. Rob
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Len(TextBox1) <> 6 Then
MsgBox "This field needs to be exactly 6 characters"
Cancel = True
End If
End Sub Rob
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.