Saturday, July 19, 2008 – Permalink –
Run a Macro from Cell
How to do the impossible (almost)
There are times when it might be nice to run a macro from a cell function.
Something like : if a cell has a certain value, a macro will run:
You can not initiate a macro from a worksheet cell function. However, you can use the worksheet's Change event to do something like this:
After posting this, Ross Mclean of Methodsinexcel.co.uk came up with a great work around using a User Defined Function.
You can see the simple coding here:
Running a macro from a cell.
Public Function RMAC _
when invoked by this worksheet formula:
runs the sub MyMacro with some modification. The Beep is executed, the cell color change is not.
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
See all Topics
<Doug Klippert@ 2:09 AM
Comments: Post a Comment