SOLVED

Excel

%3CLINGO-SUB%20id%3D%22lingo-sub-2558547%22%20slang%3D%22en-US%22%3EExcel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2558547%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20worksheet%20that%20contains%20a%20'button%C2%B4%20and%20a%20'drop-down%20list'.%3C%2FP%3E%3CP%3EWhen%20the%20'button'%20is%20clicked%2C%20it%20runs%20a%20macro%20that%20deletes%20the%20content%20of%20a%20set%20of%20specific%20cells.%3C%2FP%3E%3CP%3EWhen%20the%20drop-down%20list%20changes%20a%20different%20macro%20is%20run.%3C%2FP%3E%3CP%3EI%20need%20the%20drop-down%20list%20to%20run%20it%C2%B4s%20macro%20and%20then%20to%20automatically%20run%20the%20macro%20that%20is%20attached%20to%20the%20button.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20instinct%20tells%20me%20that%2C%20even%20at%20my%20novice%20level%2C%20this%20should%20be%20easy%20to%20accomplish%2C%20but%20I%20cannot%20find%20a%20solution%20in%20HELP%20nor%20can%20I%20create%20one.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWould%20someone%20be%20kind%20enough%20to%20help%20me%2C%20please%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks%20...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2558547%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2558565%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2558565%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F388625%22%20target%3D%22_blank%22%3E%40tomc72%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20simply%20call%20the%20macro%20associated%20with%20the%20button%20from%20the%20macro%20associated%20with%20the%20drop-down%20list%20by%20inserting%20its%20name%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3E'%20Macro%20for%20the%20command%20button%3A%0ASub%20ButtonMacro()%0A%20%20%20%20Range(%22D2%3AD50%22).ClearContents%0AEnd%20Sub%0A%0A'%20Macro%20for%20drop-down%20list%3A%0ASub%20DropdownlistMacro()%0A%20%20%20%20'%20Do%20some%20stuff%0A%20%20%20%20...%0A%20%20%20%20'%20Call%20the%20other%20macro%0A%20%20%20%20ButtonMacro%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2558586%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2558586%22%20slang%3D%22en-US%22%3EJust%20like%20that!%3CBR%20%2F%3EThank%20you%20Hans%2C%20so%20much!%3CBR%20%2F%3E%3Athumbs_up%3A%3Athumbs_up%3A%3Athumbs_up%3A%3Athumbs_up%3A%3C%2FLINGO-BODY%3E
Contributor

I have a worksheet that contains a 'button´ and a 'drop-down list'.

When the 'button' is clicked, it runs a macro that deletes the content of a set of specific cells.

When the drop-down list changes a different macro is run.

I need the drop-down list to run it´s macro and then to automatically run the macro that is attached to the button.

 

My instinct tells me that, even at my novice level, this should be easy to accomplish, but I cannot find a solution in HELP nor can I create one.

 

Would someone be kind enough to help me, please?

 

Many thanks ...

2 Replies

@tomc72 

You can simply call the macro associated with the button from the macro associated with the drop-down list by inserting its name:

' Macro for the command button:
Sub ButtonMacro()
    Range("D2:D50").ClearContents
End Sub

' Macro for drop-down list:
Sub DropdownlistMacro()
    ' Do some stuff
    ...
    ' Call the other macro
    ButtonMacro
End Sub
best response confirmed by tomc72 (Contributor)
Solution
Just like that!
Thank you Hans, so much!