![]() |
Cell Event Handler
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 |
Cell Event Handler
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 wrote in message ... 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 |
Cell Event Handler
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) www.rondebruin.nl "David" wrote in message ... 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 |
Cell Event Handler
Thanks for your help. The code works great!
|
All times are GMT +1. The time now is 06:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com