ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Spreadsheet (https://www.excelbanter.com/excel-programming/327782-spreadsheet.html)

robbie

Spreadsheet
 
I need to track information on a spreadsheet and need to know how long that
information has been lying there. Is there a timer or clock one can insert to
do this.

Patrick Molloy[_2_]

Spreadsheet
 
you could use th eworksheet's CHANGE event to add a timestamp to mark when
the value was entered.
right click the sheet tab *& go to the code page, add thsi:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
' check column B
If Target.Column = 2 Then
Target.Offset(0, -1).Value = Format(Now, "dd-mmm-yy hh:mm")
End If
End Sub

if you enter anything in column B it adds a timestamp to column A

"Robbie" wrote:

I need to track information on a spreadsheet and need to know how long that
information has been lying there. Is there a timer or clock one can insert to
do this.


Bob Phillips[_6_]

Spreadsheet
 
The easiest way is to have an adjacent column that stores the time when
something is changed, along the lines of

Private Sub Worksheet_Change(ByVal Target As Range)
Static prevValue

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("K1:K34")) Is Nothing Then
With Target.Offset(0, 1)
.Value = Now
.NumberFormat = "dd mmm yyyy hh:mm:ss"
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Robbie" wrote in message
...
I need to track information on a spreadsheet and need to know how long

that
information has been lying there. Is there a timer or clock one can insert

to
do this.





All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com