Thread: Auto enter date
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Auto enter date

What did you do with the answer I sent?

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("f2:f1000"), Cells) Is Nothing Then
'Application.EnableEvents = False 'not needed
If UCase(Target) = "CLOSED" Then Target.Offset(, 4) = Date
End If
'Application.EnableEvents = True 'not needed
End Sub


--
Don Guillett
SalesAid Software

"Scott Marcus" wrote in message
...
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?