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.
In it's simplest form, to capture the time in D when value in C changes, you will need something like below...
Excel 2007
A
B
C
D
1
I/D
Item
Value
Time Stamp
2
1001
Red One
£ 8.00
11:32
3
1002
Blue One
£ 9.00
11: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
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.