Timestamp when a cell is modified by formula (Excel)
I need a way to mark an adjacent cell whose value changes by a formula. Using this as an example, I need a cell adjacent to A1 in sheet 1 to mark the date and time the cell value changed.
The example I linked to above triggers a message box when a cell value changes by a formula (workheet_change events are not displayed to recognize cell value changes when it contains a formula whose value changes due to a cell change elsewhere). I don't want a message box, but I need a timestamp.
For simplicity's sake, I'll post instructions on this related question here, any additional help with this specific question would be appreciated.
In Sheet1 Cell A1 put this formula
=Sheet2!A1+1
Now in the module paste this code
Public PrevVal As Variant
Paste this into the code area of the sheet
Private Sub Worksheet_Calculate()
If Range("A1").Value <> PrevVal Then
MsgBox "Value Changed"
PrevVal = Range("A1").Value
End If
End Sub
Finally, in the Code for this book field, paste this code
Private Sub Workbook_Open()
PrevVal = Sheet1.Range("A1").Value
End Sub
source to share
Change MsgBox "Value Changed"
to:
Range("B1").Value = Format(Now, "dd/mm/yyyy hh:mm:ss")
or whatever the timestamp format you require
source to share