Forum Discussion
Carsten0764
Mar 04, 2021Copper Contributor
I want a macro to run in Excel 365 when a cell returns a certain value
Example: =WENN(E3=1;Macroname();"") so when E3=1 the macro with the name "Macroname()" should run. This isn't accepted, an error-message of "wrong syntax" is displayed, highlighting the "()" in th...
- Mar 05, 2021
In one of my previous replies, I wrote
"Make sure that TestMakro1 is a function, not a procedure (sub) and that it is located in a standard module in the workbook with the formula."
The function called in your formula is MakrotestStart. This function is located in the worksheet module of Tabelle1. That is precisely the problem! It should be in the standard module Modul1.
See the attached version.
ZaklinBelfor
Mar 04, 2021Copper Contributor
Run the Macro by Clicking on a Shape
One of the easiest ways to run a macro is to have a button in the worksheet and click that button to execute the macro.
It’s easy and intuitive.
The benefit of this method is that it makes it really easy and intuitive for anyone to run the macro. Even if you share the workbook with someone who has no knowledge of VBA, he/she can just click on the button and see the actions take place (without even knowing what happens in the back end).
One of the easiest ways to run a macro is to have a button in the worksheet and click that button to execute the macro.
It’s easy and intuitive.
The benefit of this method is that it makes it really easy and intuitive for anyone to run the macro. Even if you share the workbook with someone who has no knowledge of VBA, he/she can just click on the button and see the actions take place (without even knowing what happens in the back end).
Carsten0764
Mar 05, 2021Copper Contributor
Hello, ZaklinBelfor, Thanks for the suggestion, but that is exactly what I do NOT want to do. I want the macro too start as soon as a value in one cell changes to a certain value, a button will not serve the purpose.
Thanks anyway, Best Regards, Carsten
Thanks anyway, Best Regards, Carsten