Thread: Auto enter date
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Scott Marcus Scott Marcus is offline
external usenet poster
 
Posts: 28
Default Auto enter date

J. E. McGimpsey's code for date stamps works great. My question is, what if
I want to date stamp when only a certain value is entered, how would I do
that?

Here's the code with some of my specifics:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("F6:F9999"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 5).ClearContents
Else
With .Offset(0, 5)
.NumberFormat = "mm-dd-yy"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub

I'd like Column K to be date stamped only when the value of column F =
"Closed". With every other value, including blank, I'd like column K to be
empty, even if it previously had a value. Does anyone know how I can
accomplish this?