I do not know the correct number format or the range, but put this into the correct worksheet's code module and adjust to suit
I don't personally like 'helper' cells so this just pops up a message box
Option Explicit
Const csCheckRange = "A1:E20" ' change
Const csNationalNumber = "###-#####-??[A-M]" ' change
'Online help for the Like operator
' Characters in pattern Matches in string
' ? Any single character.
' * Zero or more characters.
' # Any single digit (0–9).
' [charlist] Any single character in charlist.
' [!charlist] Any single character not in charlist.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rCell As Range
If Intersect(Target, Range(csCheckRange)) Is Nothing Then Exit Sub
Target.Interior.Color = vbGreen
For Each rCell In Target.Cells
If Not rCell.Value Like csNationalNumber Then
Application.EnableEvents = False
rCell.Interior.Color = vbRed
Call MsgBox("Data in " & rCell.Address & " must be in format " & csNationalNumber, vbCritical + vbOKOnly, "Format Check")
rCell.ClearContents
rCell.Select
Application.EnableEvents = True
Exit Sub
End If
Next
End Sub
Attachments here seem to be finicky. The only reliable way I've found to to go Advanced, Add Files, and select Basic Uploader from the little Browse box. Doing Add Files just seems to not do anything
Paul