VBA Time Stamp but only if equalling specific data validation

Greenies08

New Member
Joined
Apr 4, 2011
Messages
22
Hi, I am not knowledgable in VBA at all. I have found the following that works a treat to time stamp in column J when column K is not equal to nothing. BUT, I want a separate timestamp that will time stamp only when the selection in Column K is specific i.e. "3. Send to Accounts"

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns("H:H")) Is Nothing Then
For Each I In Intersect(Target, Columns("H:H"))
If Not IsEmpty(I) Then
I.Offset(0, 2).Value = Now
Else
I.Offset(0, 2).ClearContents
End If
Next I
End If
End Sub

Appreciate anyone's brain power and will give all credibility to you ;)
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
TEST (1)


I have created a simple version (columns now A-D). I have change the VBA accordingly I think.

Any help truly appreciated.
 
Last edited:
Upvote 0
Thanks for the test file.
In it you have 3. Sent To Lender, rather than 3. Send to Accounts, which is one reason why it's not working.
The other is that I misread the code.
try
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Not Intersect(Target, Columns("a:a")) Is Nothing Then
      For Each i In Intersect(Target, Columns("a:a"))
         If i.Value = "3. Sent To Lender" Then
            i.Offset(, 3).Value = Now
         ElseIf Not IsEmpty(i) Then
            i.Offset(0, 2).Value = Now
         Else
            i.Offset(0, 2).ClearContents
         End If
      Next i
   End If
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,844
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top