I have the following simple piece of code which updates a cell when the one adjacent changes – ie it keeps track of when updates are made:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False ‘Turn events off, or the changes progoate across the worksheet !
If ActiveCell.Column = 2 Then ‘Only apply the behaviour when the cell which changes is in Column 2
If ActiveCell.Row > 6 Then Target.Offset(0, 1) = Int(Now()) ‘Protects rows 1 to 6 from this behaviour
End If
Application.EnableEvents = True ‘Turn events back on
End Sub
If any cell in Column 2 has its value changed, the corresonding cell in Column 3 has the date set to “now”.
This all works fine when type the new value, or (as is the normal case) the new value is entered by a macro.
For various reasons, I have had to use formulae in the cells which can change, and the code no longer picks up the changes.
So my question is this: how do I make Excel spot that a particular cell’s value has changed and, if it has, update the date in the cell to its right ?
Many thanks
Martin