I've got an ActiveX text box and I'd like to validate what people type in it, and have a message box appear and the box cleared if the entry is invalid. The entry should only be validated once the user leaves the text box e.g. if they click on another part of the form.
The text box entry should be a ten digit number.
So far I have:
When I put a four digit number into TEXTBOX, and click into another box, nothing happens.Private Sub TEXTBOX_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not TEXTBOX Like "##########" Then
MsgBox ("TEXTBOX should be ten digit number")
End If
End Sub
I'd also like the box to be cleared and the cursor placed back in the box so the user can have another shot at it. I'm using Excel 2007.
Bookmarks