Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet_Change does it fire for a cell changed via foruma?

I know the Worksheet_Change fires for when a user updates a range of
cells and the range of cells is passed to the Worksheet_Change sub.
What about when a cell is changed from a formula? Worksheet_Change
doesn't seem to fire when a cell is changed as a result of a forumula
calucation.

Example:
Cell A2 is calcuated by the value of A1 + 1

If you change A1, A2 now changes as well but the Worksheet_Change is
fired but the Target only includes A1 and Worksheet_Change is not
fired again for A2.

Is there a way to capture the change just on A2?

Obviously on every change i can just check to see if i need to make my
adjustments. But their is a performance reason why i cannot. So i only
want to run if indeed the correct cell has been changed not on every
change.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Worksheet_Change does it fire for a cell changed via foruma?

You may need to use the Calculate Event instead of the Change Event.
--
Gary''s Student - gsnu2007g


" wrote:

I know the Worksheet_Change fires for when a user updates a range of
cells and the range of cells is passed to the Worksheet_Change sub.
What about when a cell is changed from a formula? Worksheet_Change
doesn't seem to fire when a cell is changed as a result of a forumula
calucation.

Example:
Cell A2 is calcuated by the value of A1 + 1

If you change A1, A2 now changes as well but the Worksheet_Change is
fired but the Target only includes A1 and Worksheet_Change is not
fired again for A2.

Is there a way to capture the change just on A2?

Obviously on every change i can just check to see if i need to make my
adjustments. But their is a performance reason why i cannot. So i only
want to run if indeed the correct cell has been changed not on every
change.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Worksheet_Change does it fire for a cell changed via foruma?

From a previous post:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
On Error GoTo errExit
Application.EnableEvents = False
Set rng = Range("C1").Precedents

If Not Intersect(Target, rng) Is Nothing Then

' If Range("C1").Value < 0 Then
' do something
MsgBox Range("C1").Value
' End If
End If

errExit:
Application.EnableEvents = True
End Sub

The above is looking for any change in cell(s) linked to C1. Big caveat,
unfortuantely rng.Precedents does not return cells on other sheets, more
work to do if necessary

Regards,
Peter T

wrote in message
...
I know the Worksheet_Change fires for when a user updates a range of
cells and the range of cells is passed to the Worksheet_Change sub.
What about when a cell is changed from a formula? Worksheet_Change
doesn't seem to fire when a cell is changed as a result of a forumula
calucation.

Example:
Cell A2 is calcuated by the value of A1 + 1

If you change A1, A2 now changes as well but the Worksheet_Change is
fired but the Target only includes A1 and Worksheet_Change is not
fired again for A2.

Is there a way to capture the change just on A2?

Obviously on every change i can just check to see if i need to make my
adjustments. But their is a performance reason why i cannot. So i only
want to run if indeed the correct cell has been changed not on every
change.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Worksheet_Change does it fire for a cell changed via foruma?

So long as the dependants of the cell with the formula are on the same sheet
as the formula then you can catch changes to those dependant cells like
this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A2"), Target.Dependents) Is Nothing Then
MsgBox "Tada"
End If
End Sub
--
HTH...

Jim Thomlinson


" wrote:

I know the Worksheet_Change fires for when a user updates a range of
cells and the range of cells is passed to the Worksheet_Change sub.
What about when a cell is changed from a formula? Worksheet_Change
doesn't seem to fire when a cell is changed as a result of a forumula
calucation.

Example:
Cell A2 is calcuated by the value of A1 + 1

If you change A1, A2 now changes as well but the Worksheet_Change is
fired but the Target only includes A1 and Worksheet_Change is not
fired again for A2.

Is there a way to capture the change just on A2?

Obviously on every change i can just check to see if i need to make my
adjustments. But their is a performance reason why i cannot. So i only
want to run if indeed the correct cell has been changed not on every
change.

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
Format changed when the details in cell changed angel Excel Worksheet Functions 9 July 15th 08 12:36 AM
Ranging foruma in excel Mark Scott[_2_] Excel Worksheet Functions 5 February 25th 07 06:33 PM
worksheet_change event when multiple cells changed (pasted) noddy26 Excel Programming 13 July 24th 04 09:59 PM
Worksheet_Change event won't fire to execute Macro??? jpdill5 Excel Programming 2 February 13th 04 02:34 PM
Excel foruma for Exclusive numbers Donna[_4_] Excel Programming 1 August 29th 03 03:46 AM


All times are GMT +1. The time now is 01:56 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"