Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default CELL CHANGE EVENT

Hello. I'm trying to figure out how to run a function when data in a
particular cell changes. What's the change handler I would use for that?
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default CELL CHANGE EVENT

Hi,
it depends how the cell value is changed. if it is by user interaction then
the Worksheet_Change event will suffice..

Private Sub Worksheet_Change(ByVal Target As Range)
If target.Address = "$A$1" then
....your code

End If
End Sub

However, there are certain things that do not fire this event. For example
when a linked cell from a Forms Listbox changes this does not fire this
event...

Hth,
Oli

--
Message posted via http://www.officekb.com
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default CELL CHANGE EVENT

Hi Dan,

you can write a macro inside a sub for the sheet in question using:

Private Sub Worksheet_Change(ByVal Target As Range)

....macro to run when there is a change....

End Sub

Note: this will run regardless of which cell changes, so you may want to run
a check against the cell that is changing to see if the macro should be run.

Simon


"Dan" wrote:

Hello. I'm trying to figure out how to run a function when data in a
particular cell changes. What's the change handler I would use for that?
Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default CELL CHANGE EVENT

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:H10")) 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)


"Dan" wrote in message
...
Hello. I'm trying to figure out how to run a function when data in a
particular cell changes. What's the change handler I would use for that?
Thanks.



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
Change Event on a Specific Cell Sashi Excel Worksheet Functions 3 July 20th 07 11:12 PM
cell change event gvm Excel Worksheet Functions 3 September 20th 05 04:50 AM
cell value change event alinasir Excel Worksheet Functions 1 August 30th 05 10:57 AM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM
Cell Change Event Graham[_6_] Excel Programming 8 February 26th 04 04:27 PM


All times are GMT +1. The time now is 09:42 AM.

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"