The change handler actually has a Target parameter. There's a nice little
example in the help that sets the text of every changed cell to blue.
The code from the help:
Private Sub Worksheet_Change(ByVal Target As Range)
Target.Font.ColorIndex = 5
End Sub
Being a perverse type, I decided to lock things up a bit. My change to the
sub
Private Sub Worksheet_Change(ByVal Target As Range)
Target.Font.ColorIndex = 5
Target.Activate
End Sub
It still turns it blue, but immediately reactivates it too.
Adding this to the code
MsgBox Target.Value & " vs " & ActiveCell.Value
throws up a problem, though.
Active cell is empty, cell to the right is also empty. Type A and hit right
arrow. MsgBox gives "A vs". Go back. Type B and hit enter (assuming you
have enter set not to move the cursor). MsgBox gives "B vs B".
I.e. Target has the new value, not the old value. I don't remember the
original question, so am not sure whether this is a problem or not.