open a new workbook and expriment this
rightclick sheet tab and click view code there you copy this evnet code
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo eerr
If Len(Target) = 8 And Not IsNumeric(Left(Target, 1)) _
And IsNumeric(Mid(Target, 2, 2)) And Not IsNumeric(Mid(Target, 4, 1)) _
And IsNumeric(Right(Target, 4)) Then
MsgBox "valid"
Else
MsgBox "not valid"
Target.Clear
End If
eerr:
Application.EnableEvents = True
End Sub
the only problem when you enter something in any cell this event code runs. to restrict this only some range or column you can add a condition in the beginning.
your comments please
Bookmarks