Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range, CellText As String
If Not Intersect(Target, Columns("A")) Is Nothing Then
For Each Cell In Target
CellText = UCase(Cell.Text)
If Len(CellText) = 0 Then Exit Sub
If CellText = "NO CLAIM" Then
Application.EnableEvents = False
Cell.Value = "Validated"
Application.EnableEvents = True
Exit Sub
ElseIf IsDate(CellText) And CellText Like "*[!0-9]*" Then
Application.EnableEvents = False
Cell.Value = CDate(CellText)
Application.EnableEvents = True
Cell.NumberFormat = "dd/mm/yyyy"
Exit Sub
End If
MsgBox " Invalid Entry!" & vbCr & "Please enter one of the following: " & vbCrLf & vbCrLf & "type the text 'no claim'" & vbCr & "date (in dd/mm/yyyy format)" & vbCr & "leave blank"
Target.Select
Next
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Cell As Range
If Not Intersect(Target, Columns("A")) Is Nothing Then
For Each Cell In Target
Target.NumberFormat = "General"
Next
End If
End Sub