Worksheet 'on Change' event
Maybe this will help. Let's say the specific cell you want to watch for is
C5. You could check the address of the range that was just changed (first
macro). It is not very flexible in that if you insert any rows/columns or
move cell C5, it will no longer work. Also, if you changed a range (say
C3:C6) it will not recognize cell C5 was changed. If either of these issues
are problematic in your situation, the second one assumes I've named cell C5
"NamedRange" and tests to see if this cell intersects the range that was
changed.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$5" Then MsgBox "hello"
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Isect As Range
Set Isect = Application.Intersect(Target, Range("NamedRange"))
If Not Isect Is Nothing Then MsgBox "hello"
End Sub
"Damien McBain" wrote:
How do I refer to the cell I just changed?
I need to run the on change event but only if the cell I just changed was
one specific cell.
|