Macro to run when formula result changes

scarlett3

Board Regular
Joined
Jan 21, 2005
Messages
69
Hi

I have an IF formula in cell B9 then either returns "N" or "Y" as the result. I've read that a macro cannot be run based on changed in formula results, but is there a workaround to this?

I'd like the macro to run if the formula result changes from "N" to "Y".

Thanks!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,752
Office Version
  1. 365
Platform
  1. Windows
What is this formula in B9?
Do you only want it to run the first time it changes from "N" to "Y"?
 

scarlett3

Board Regular
Joined
Jan 21, 2005
Messages
69
It's a simple =IF(H6>H1,"Y","N") formula.

Yes, I suppose I would only want it to run the macro once, just in case the various cell values changed so that it alternated between "Y" and "N".
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
So, how are the values in H6 and H1 changed?
User Input? Data Import?, Formula? If Formula, what is it?

lenze
 

scarlett3

Board Regular
Joined
Jan 21, 2005
Messages
69
H1 is a fixed value; H6 is a value from a data import which refreshes every second.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,752
Office Version
  1. 365
Platform
  1. Windows
Sounds like you might want to use the Worksheet_Calculate Event Procedure.

Chip Pearson did a nice write-up on them a few years ago: http://www.cpearson.com/excel/Events.aspx

You can also find some good examples if you search this forum for "Worksheet_Calculate".
 

Watch MrExcel Video

Forum statistics

Threads
1,133,714
Messages
5,660,431
Members
418,580
Latest member
JP82

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top