Please would a VBA enthusiast help me out with this one. Your help is much appreciated.
On a worksheet, I need to allow user to enter a date into any cell in column H but not allow the date to be deleted or changed.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
I managed to put together this bit of code which stops the date from being deleted. But the problem is, it still allows the date to be changed:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)<o></o>
<o></o>
On Error GoTo ResetEvents<o></o>
Application.EnableEvents = False<o></o>
<o></o>
If Not Application.Intersect(Target, Range("H:H")) Is Nothing Then<o></o>
If IsDate(Target.Value) = True Then<o></o>
<o></o>
Application.EnableEvents = True<o></o>
Exit Sub<o></o>
Else<o></o>
Application.Undo
<o></o>
End If 'IsDate<o></o>
End If 'Not Application.Intersect
ResetEvents:<o></o>
Application.EnableEvents = True
<o></o>
End Sub<o></o>
On a worksheet, I need to allow user to enter a date into any cell in column H but not allow the date to be deleted or changed.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
I managed to put together this bit of code which stops the date from being deleted. But the problem is, it still allows the date to be changed:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)<o></o>
<o></o>
On Error GoTo ResetEvents<o></o>
Application.EnableEvents = False<o></o>
<o></o>
If Not Application.Intersect(Target, Range("H:H")) Is Nothing Then<o></o>
If IsDate(Target.Value) = True Then<o></o>
<o></o>
Application.EnableEvents = True<o></o>
Exit Sub<o></o>
Else<o></o>
Application.Undo
<o></o>
End If 'IsDate<o></o>
End If 'Not Application.Intersect
ResetEvents:<o></o>
Application.EnableEvents = True
<o></o>
End Sub<o></o>