Hi All,
Desperate to get a data validation on columns E and F in VBA for dates only with a msg box on Sheet1.
Anyone help please?
Regards
Chris
Hi All,
Desperate to get a data validation on columns E and F in VBA for dates only with a msg box on Sheet1.
Anyone help please?
Regards
Chris
Try this worksheet event code
[vba]
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit
Application.EnableEvents = False
With Target
If .Cells.Count = 1 Then
If .Column = 4 Or .Column = 5 Then
If .Row > 1 Then
If Not IsDate(.Value) Then
MsgBox "Not a date"
.Value = ""
End If
End If
End If
End If
End With
ws_exit:
Application.EnableEvents = True
End Sub[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber