Forum Discussion
I want a macro to run in Excel 365 when a cell returns a certain value
- 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.
ā
Hello, Hans,
Thanks for the answer, but this is not what I mean.
Lets say: If the value E3 changes from 0 to 1 I want the Makro Testmakro1() to run.
So in, for example E4, I enter the following formula: =WENN(E3=1;Testmakro1();"")
In all the forums that I looked into this formula was described like that and I remember I myself used it in an older Excel-Version.
Now I changed to Excel 365, and suddenly the Syntax is rejected, marking the double bracket of the Makroname as wrong.
I can program a Function like Function1() and enter that, and still the syntax is rejected as wrong - but all Functions, Makros etc. automatically get that () at the end of their names.
Has there been a change for that syntax in Excel 365?
Best Regards,
Carsten
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.
- Carsten0764Mar 04, 2021Copper ContributorYes, I do, but even the function name automatically gets the "()" at the end, and that is refused with a syntax error, I simply cannot enter it in the WENN Formula. It's not that the function won't execute - at least I can't test that, because the WENN-formula steadfastly refuses the function name.
BR,C.- HansVogelaarMar 04, 2021MVP
That is strange - it works for me.
Could you attach a small sample workbook without sensitive information that demonstrates the problem?
- Carsten0764Mar 05, 2021Copper Contributor
HansVogelaar Hello, Hans, sorry, I was away for a day and couldn't answer.
I'll attach a short Test-sheet with the problem and a couple of explanatory screenshots.
Thanks for having a look at this.
Best Regards,
Carsten