Home / User Contributed Macros / Track Editing Time

Track Editing Time


The following macro code is used to set the cell edited time to the first column of the edited row, This will be very useful to track the time when the data is changed.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = false
On Error Goto ENEV
Range("A" & Target.Row).Value = Now
ENEV:
Application.EnableEvents = true
End Sub
 

    pvojnisek  13 Oct 2008 
    I have just copied the code into macro editor (This workbook).
    Unfortunatelly, nothing happens changing any cells in my sheets.. :-(
    P
    Select the sheet name(e.g.Sheet1) from the left panel of the macro editor and copy the above code and paste it into the editor. Save the code and close the editor. Now change the cells in the Sheet1 where you pasted the code, you can see the current time is set to the first column of that changed row.
    I created two macros in two different buttons: star and end. By clicking start, the selected cell will return the time.By clicking the end, the end time will return in another cell. So, I can calculate the time between the start and end. But, how can I fix these values, so they do not change when I close and open the sheet? I mean, how to not change the time, except by clicking the button?
    Abinaya Kannan  06 Sep 2013 
    Hi Fabio,
    The values in the cell will not change unless you have formula in that cell. Calculate the end time; assign it to a variable and set it to the cell.

    If you need help in fixing it, please post your macro here or send it to support@zohosheet.com .
    Thanks
    Sub startwork1()
    '
    ' startwork1 Macro
    ' Criado por un1378395622940r40id em Fri, Sep 2013 11:31:26 AM
    '
    Range("B7").Select
    ActiveCell.Formula="=NOW()"
    End Sub
    Sub stopwork1()
    '
    ' stopwork1 Macro
    ' Criado por un1378395622940r40id em Fri, Sep 2013 11:32:08 AM
    '
    Range("C7").Select
    ActiveCell.Formula="=NOW()"
    End Sub

    Each macro must run by click a button called Star Work and Stop Work. but I´m using the formula NOW, as you said, nd the current date/time is change when I open the sheet. I need the change only when clicked the button. Thanks
    I made this change:
    ActiveCell.Formula...
    to
    ActiveCell.Value = Now
    Working good now.
    Khaled Khaled Ashour  30 Mar 2022 
    Hi, need time stamp to show in columns 31 and 32 whenever columns 21 and 24 respectively are updated
    Thanks,



     RSS of this page