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.
NikolinoDE
Mar 05, 2021Gold Contributor
Sub test()
wert = Sheets(1).Range("a1").Value
If wert=1 Then
'DeinMakro
End If
End Sub
Wenn Ihnen diese Informationen weitergeholfen haben, bitte markieren Sie diesem Post als "Richtige Antwort" und auf Like (Hand mit Daumen hoch), somit können auch andere Mitglieder von diese Info später profitieren. Wenn Ihnen die Informationen nicht weitergeholfen haben, bitte ignorieren sie diese Informationen.
Nikolino
I know I don't know anything (Socrates)
wert = Sheets(1).Range("a1").Value
If wert=1 Then
'DeinMakro
End If
End Sub
Wenn Ihnen diese Informationen weitergeholfen haben, bitte markieren Sie diesem Post als "Richtige Antwort" und auf Like (Hand mit Daumen hoch), somit können auch andere Mitglieder von diese Info später profitieren. Wenn Ihnen die Informationen nicht weitergeholfen haben, bitte ignorieren sie diese Informationen.
Nikolino
I know I don't know anything (Socrates)
Carsten0764
Mar 05, 2021Copper Contributor
Hallo, Nikolino,
das probiere ich auf jeden Fall auch aus, Danke!
Hans hatte das Problem allerdings mit seinem Vorschlag bereits gelöst
Beste Grüße,
Carsten
das probiere ich auf jeden Fall auch aus, Danke!
Hans hatte das Problem allerdings mit seinem Vorschlag bereits gelöst
Beste Grüße,
Carsten
- NikolinoDEMar 05, 2021Gold ContributorHabe es im Nachhinein auch gesehen.
Naja ein Lösungsvorschlag mehr kann nicht schaden.
Wenn es mit Hans Vorschlag geklappt hat ist doch Super!
Viel Spaß mit Excel
Nikolino