Conditional time stamping

Mark Mackay

New Member
Joined
Nov 18, 2009
Messages
3
Using "control shift colon ( : )" a time stamp can be put in a cell. I want to add a time stamp every time a drop-down menu option is chosen. Can anyone please help me with a method for doing this? Some additional context: I want to have two columns - call col A the drop-down menu column and col B the time stamp col. I will select from col A at different times throughout a session. Indeed - it is possible that I will have several sets of col A and col B on the same worksheet.
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Hi and welcome to the Board!!
Code:
Private Sub WorkSheet_Change(ByVal Target as Range)
If Target.Count > 1 Then Exit Sub 'Work only if one cell is changed
If Target.Column <>1 Then Exit Sub 'Work only if Col "A" is changed
Cells(Target.Row,2) = Time 'Put time in Col "B"
End Sub
This goes in the WorkSheet module. Right Click the sheet tab and choose "View Code"
That will do what you asked!!
That said, what do you really need to do? There might be something better
lenze
 

Mark Mackay

New Member
Joined
Nov 18, 2009
Messages
3
Hi Lenze

many thanks for your quick response. I'm using excel to capture observations. So column A is my drop down list of the observation and column b is the time stamp of when I record it. You might think that it's trivial to ask someone to use control shift colon, but this would represent an extra thing to think about when we want their focus on the observing. So recording needs to be as easy as possible. An ideas to do this in a different way would be welcomed.

Mark
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Just try the code I posted then. It will do what you require. When you change a cell in Col "A, the time will be entered in Col "B" And it's not trivial to automate repetitive tasks such as this!!
lenze
 

Mark Mackay

New Member
Joined
Nov 18, 2009
Messages
3

ADVERTISEMENT

Thanks again Lenze - your help has been greatly appreciated :) Mark
 

ProZak

New Member
Joined
Sep 30, 2009
Messages
8
How could you do this with multiple columns?

In other words a selection from a drop down in column "a" puts a time stamp in column "b", and/or a selection in column "d" puts a time stamp in column "e" ?

my example is i'm tracking when a request is made in column "a" and when an answer is given in column "d" (tracking response times)...

Thanks for your time.
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Hi ProZak and welcome to the Board!!
Rich (BB code):
Private Sub WorkSheet_Change(ByVal Target as Range)
If Target.Count > 1 Then Exit Sub 'Work only if one cell is changed
If Target.Column <>1 And Target.Column <> 4 Then Exit Sub 'Work only if Col "A" or "D" is changed
Cells(Target.Row,Target.Column +1) = Time 'Put time in Col "B" or "D"
End Sub

If you have more than 2 or 3 columns, there may be a better approach. If you need more help, post your specifics.
lenze
 

ProZak

New Member
Joined
Sep 30, 2009
Messages
8
Thanks!

I have struggled with this problem for some time now...

It works perfectly :)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,518
Messages
5,596,631
Members
414,082
Latest member
sasmita

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
Top