Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run a macro when updating a cell

I want to run a Macro when the contents of a cell are changed. I am familiar
with running a macro when updating a worksheet or when clicking a button but
can not find the right event for running one when only a cell has changed.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Run a macro when updating a cell

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:H10"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
'do your stuff
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim Hartley" <Jim wrote in message
...
I want to run a Macro when the contents of a cell are changed. I am

familiar
with running a macro when updating a worksheet or when clicking a button

but
can not find the right event for running one when only a cell has changed.



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
Automation Macro for updating formula when changing cell value Danny Excel Discussion (Misc queries) 2 August 17th 07 02:22 AM
Automation Macro for updating formula when changing cell value Danny Excel Discussion (Misc queries) 0 August 17th 07 01:47 AM
Regarding auto updating Macro sumi1 Excel Discussion (Misc queries) 0 July 3rd 07 07:58 AM
Macro for updating workbooks Sus Excel Programming 1 October 20th 04 08:40 PM
Updating Cells that Get Value from Macro Ken[_11_] Excel Programming 4 December 18th 03 02:48 AM


All times are GMT +1. The time now is 02:46 PM.

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

About Us

"It's about Microsoft Excel"