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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Where do you want the other time stamp?
 
Upvote 0
Column K, sorry I see a made a mistake in saying the data validation was in Column K, it's actually in Column H as per the VBA.

So, column H has a drop down menu.
When ever it is changed, Column J will auto date/time stampthat it was the last amendment.
I was Column K to date/time stamp when Column H has onlybeen changed to an option i.e. “3. Send to Accounts”
 
Upvote 0
How about
Code:
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
         ElseIf i.Value = "3. Send to Accounts" Then
            i.Offset(, 3).Value = Now
         Else
            i.Offset(0, 2).ClearContents
         End If
      Next i
   End If
End Sub
 
Upvote 0
That doesn’t work, would the ElseIf i.Value not be h instead as that’s where the “Send to Accounts” is?
 
Last edited:
Upvote 0
What si the exact value you want to check for & where is it?
 
Upvote 0
Sorry, you are being so kind and I’m probably not makingsense.

I have 4 columns:
H – has data validation in
I – is not to be used
J – I want to date/time stamp the latest change selected inColumn H
K – I want to date/time stamp only the latest time “3. Sent toAccounts” is selected in H

 
Upvote 0
In that case the code should work, as long as H is exactly "3. Send to Accounts", check that you don't have any leading/trailing spaces & that the internal spaces are single spaces.
 
Upvote 0

Forum statistics

Threads
1,215,483
Messages
6,125,065
Members
449,206
Latest member
Healthydogs

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