ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run macro from IF function (https://www.excelbanter.com/excel-programming/278234-run-macro-if-function.html)

Stu[_23_]

Run macro from IF function
 
Hi,
I want to run a macro from an if, how do I do this?


Thanks

Stu



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Chip Pearson

Run macro from IF function
 
Stu,

Functions called from worksheet cells can only return a value; they cannot
change the Excel environment in any way, including changing the value of any
cell. The reason is that Excel must keep a model of what cells depend on
what other cells, called the "dependency tree", in order to calculate cells
in the proper order. Since Excel cannot know what cells might be modified by
a VBA macro, it prevents you from changing any cell.

So the short answer is that you can't do this.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Stu" wrote in message
...
Hi,
I want to run a macro from an if, how do I do this?


Thanks

Stu



------------------------------------------------
~~ Message posted from
http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com