Cell Event Handler

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like a VBA macro to run after one cell has been updated or changed and only that one cell. I've been able to write an Event Handler for the worksheet change. The the macro runs great, but it runs all the time. I just want to run it when a single cell on the spreadsheet is changed.

Thanks in advance for any help,

David
 
in the worksheet_change event, you would test what cell triggered the event
and jump out if it isn't the cell of interest


at the top, add a line like:
if target.Address <> "$F$4" then exit sub

so the event always fires, but it doesn't do anything unless it is the cell
you want to react to.

--
Regards,
Tom Ogilvy

David said:
I would like a VBA macro to run after one cell has been updated or changed
and only that one cell. I've been able to write an Event Handler for the
worksheet change. The the macro runs great, but it runs all the time. I
just want to run it when a single cell on the spreadsheet is changed.
 
Hi David

Try this for A1

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
MsgBox "You changed A1"
End If
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)




David said:
I would like a VBA macro to run after one cell has been updated or changed and only that one cell. I've been able to write an
Event Handler for the worksheet change. The the macro runs great, but it runs all the time. I just want to run it when a
single cell on the spreadsheet is changed.
 
Back
Top