Execute Macro On Calculated Cell change

Closed
Notar - May 2, 2010 at 03:17 AM
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
- May 3, 2010 at 09:44 AM
Have tried several approaches, but nothing works

Have a cell that has a formula and changes based on other cells - want to execute a macro when ever the formula causes the cell value to change

Excel 2007

any help is appreciated. . .

________________________________________________________________________

I am new to this forum - I think I put the following comments in the answer section - my apologies. . .

________________________________________________________________________


The cell address that changes (has a formula in it) based on other cells on the data input form is C125

The cell is also protected - but even if I unprotect it, I still can't get it to execute the macro.

Here is the code I have used that I can't get to to wrk -

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$125" Then
Call WorkSheet_Calculate
End If
End Sub

I know this should be quite simple . . . but I am not seeing my mistake.

Thanks

4 replies

rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
770
May 2, 2010 at 06:38 PM
My bad. You did mention formula update, but I had missed it. '

This will not work as value changed by formula will not trigger it


This will trigger if a value is updated by formula
Private Sub Worksheet_Calculate()


End Sub


How ever looking at your example,I would say the you need to trigger the source of change

Lets say that your C125 formula is A125 + B125

Then you trigger your recalc routine when A125 or b125 changes
0