Blobajob88
Board Regular
- Joined
- Mar 27, 2020
- Messages
- 55
- Office Version
- 365
- 2019
- Platform
- Windows
Hi, I want to ensure a date is entered in a cell
If Not IsDate(Target.Value) Then
Application.EnableEvents = False
Target.Value = ""
MsgBox "Please Enter A Valid Date", vbCritical, "Invalid Data Type"
Application.EnableEvents = True
Target.Select
Application.EnableEvents = True
Sheet1.Protect
Exit Sub
End if
This works fine but if I drag the cell value down that has a date in it, this code runs. How can I avoid this?
If Not IsDate(Target.Value) Then
Application.EnableEvents = False
Target.Value = ""
MsgBox "Please Enter A Valid Date", vbCritical, "Invalid Data Type"
Application.EnableEvents = True
Target.Select
Application.EnableEvents = True
Sheet1.Protect
Exit Sub
End if
This works fine but if I drag the cell value down that has a date in it, this code runs. How can I avoid this?