Time log in transaction sheet

deniswatson

New Member
Joined
Aug 16, 2007
Messages
5
I want to record a time on the same line of a transaction log when value is added. Just a simple log that records transaction number, item, value, transaction time. Any help appreciated.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
deniswatson,

In it's simplest form, to capture the time in D when value in C changes, you will need something like below...



Excel 2007
ABCD
1I/DItemValueTime Stamp
21001Red One£ 8.0011:32
31002Blue One£ 9.0011:37
Sheet2


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
'Check if Value column "C" (=3 )edit to suit if not column 3
If Not Target.Column = 3 Then Exit Sub
Target.Offset(0, 1) = Format(Now, "hh:mm") ' formatted just to show time
'if you want date and time then remove the line above and
'remove the apostrophe from the line below


'Target.Offset(0, 1) = Now


End Sub

Right click your sheet tab >> View Code >> paste the above code into the white code pane.
If your value column is not C (3) then edit to suit.

Unless using pre xl2007, you will need to save your workbook as MacroEnabled

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,254
Members
448,556
Latest member
peterhess2002

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