Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date stamp in Excel based on Criteria 1

Status
Not open for further replies.

tcolan

Technical User
Apr 28, 2003
49
US
I am need to put a static date stamp in Column S based on data changed in Column B. I am using code that has been suggested and it is working on providing the date stamp, however I'd like to take it a step further and only have the date stamped in Column S when Column B is specifically populated with the word "Closed". Below is the code I am using right now.

Thanks for your help!
Tom


Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim r As Range
Set rng = Application.Intersect(Target, Range("B:B"))
If Not rng Is Nothing Then

Application.EnableEvents = False

For Each r In rng
With r
Cells(.Row, "S").Value = Now()
End With
Next r

Application.EnableEvents = True

End If
End Sub
 
Code:
For Each r In rng       
    With r
        If Cells(.Row, "B").Value = "Closed" Then
            Cells(.Row, "S").Value = Now()
        End If
    End With
Next r

Something like that?

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
Perfecto!

Thanks so much for your help!

-Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top