The following code is what gives me an initial timestamp (N
) and updated time (O
).
This works when the cell's in column D
on WORKSHEET1
are manually updated.
The cell's in Column D
WORKSHEET1
reference WORKSHEET2
Column E
now. So for example D4
on WORKSHEET1
is ='WORKSHEET2'!E23
.
When values are updated on WORKSHEET2
, the D
column on WORKSHEET1
updates automatically.
The timestamp code below then stops working and does not pick up this value change.
Can I insert a VBA code so that when i change the values on WORKSHEET2
, and it updates on WORKSHEET1
because of the formula in cel D
, the timestamp will work?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myTableRange As Range
Dim myDateTimeRage As Range
Dim myUpdatedRange As Range
Set myTableRange = Range("D1:D314")
If Intersect(Target, myTableRange) Is Nothing Then Exit Sub
Set myDateTimeRage = Range("N" & Target.Row)
Set myUpdatedRange = Range("O" & Target.Row)
If myDateTimeRage.Value = "" Then
myDateTimeRage.Value = Now
End If
myUpdatedRange.Value = Now
End Sub