Keeping a date from changing

Giganews Newsgroups
Subject: Keeping a date from changing
Posted by:  Steve Cohen (sacoh…@bellsouth.net)
Date: Tue, 21 Oct 2003

If have some code on my page that enters todays date in Colum D when a
choice from the drop down menu in Colum F is made.

I'm looking to change it a bit so that if I change the entry in Colum f and
a date is already in colum D it will keep what is there instead of changing
it to today's day

The existing code is...

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Range("F:F")) Is Nothing Then Exit Sub

On Error GoTo errHandler:

Application.EnableEvents = False
If LCase(Target.Value) = "bet" Then
With Target.Offset(0, -2)
..Value = Date
..NumberFormat = "MM/DD/YY"
End With
ElseIf LCase(Target.Value) = "cash back" Then
With Target.Offset(0, -2)
..Value = Date
..NumberFormat = "MM/DD/YY"
End With
Else
Target.Offset(0, -2).ClearContents
End If

errHandler:
Application.EnableEvents = True

End Sub
_________________
Thanks

Steve

Replies