ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Executing a macro from a cell (https://www.excelbanter.com/excel-discussion-misc-queries/13238-executing-macro-cell.html)

filo666

Executing a macro from a cell
 
1. There is some way to make that excel, starting from a conditional
structure in a cell, execute automatically a macro???

Something like this:
A B
1
2 1 =if(A2=1,macro1(),macro2())


Bob Phillips

No, functions can return a value, they cannot change the format or run a
macro.

You can use event code to do it, but not a worksheet function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"filo666" wrote in message
...
1. There is some way to make that excel, starting from a conditional
structure in a cell, execute automatically a macro???

Something like this:
A B
1
2 1 =if(A2=1,macro1(),macro2())




Harald Staff

Hi

No, impossible. This is a limitation by design. A macro could change the
cell itself, the sheet, excel, and therefore mess up the original logic and
the order of calculations.

But Excel has several "calculate" events that you might use to create a
simiular effect.

HTH. Best wishes Harald

"filo666" skrev i melding
...
1. There is some way to make that excel, starting from a conditional
structure in a cell, execute automatically a macro???

Something like this:
A B
1
2 1 =if(A2=1,macro1(),macro2())





All times are GMT +1. The time now is 08:43 PM.

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