Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Cell Event Handler

Thanks for your help. The code works great!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet_change event handler error gen Excel Discussion (Misc queries) 0 January 18th 08 04:55 AM
What code do I use to attach event handler that will open my user. TeresaManley Excel Worksheet Functions 2 May 5th 07 09:55 PM
error handler Fleur Excel Programming 1 November 20th 03 06:06 AM
Re : Excel event handler Worksheet_SelectionChange TKT-Tang Excel Programming 1 July 18th 03 08:27 AM
Re : Excel event handler Worksheet_SelectionChange TKT-Tang Excel Programming 1 July 16th 03 07:21 AM


All times are GMT +1. The time now is 03:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"