how to run a macro upon selecting an item from drop-down menu
I have these macros. Lets call them MacroA, MacroB, MacroC. Now I also have this drop-down menu. The drop down manu has a choice of three items: a, b, c,?
How do I write code to tell excel to: run MacroA when drop-down menu a is selected, run MacroB when drop-down menu b is selected, run MacroC when drop-down menu c is selected
I have these macros. Lets call them MacroA, MacroB, MacroC. Now I also have this drop-down menu. The drop down manu has a choice of three items: a, b, c,?
How do I write code to tell excel to: run MacroA when drop-down menu a is selected, run MacroB when drop-down menu b is selected, run MacroC when drop-down menu c is selected
Please help!
Here's the simplest way...
Place this code in the worksheet module, right click on the sheet tab and select view codes,
copy and paste this code there
This macro will run MacroA when the first item is selected, MacroB when the second item is selected, and MacroC when the third item is selected. The only code changes you would need to make are to the cell where the drop down is located and to macro names. The items are marked in blue.
How to Save a Worksheet Event Macro
1. Copy the macro using CTRL+C keys.
2. Open your Workbook and Right Click on the Worksheet's Name Tab for the Worksheet the macro will run on.
3. Left Click on View Code in the pop up menu.
4. Paste the macro code using CTRL+V
5. Save the macro in your Workbook using CTRL+S
write code to execute a Macro for a drop down menu
I have a drop down menu with two items in it. The drop down menu is located in cell b48. The two items are called "most inclusive" and "least inclusive." Upon selection of "most inclusive" from the drop-down menu I would like to run the following Macros: ReformatInc, eVestmentInc, and InformaInc. Upon selection of "least inclusive" I would like to run the following Macros: Reformat, eVestment, and Informa.
What is the simplest code one can write that executes these commands? I have tried the select case function and numerous if statments. However, these list menus are a little bit tricky.
I have a drop down menu with two items in it. The drop down menu is located in cell b48. The two items are called "most inclusive" and "least inclusive." Upon selection of "most inclusive" from the drop-down menu I would like to run the following Macros: ReformatInc, eVestmentInc, and InformaInc. Upon selection of "least inclusive" I would like to run the following Macros: Reformat, eVestment, and Informa.
What is the simplest code one can write that executes these commands? I have tried the select case function and numerous if statments. However, these list menus are a little bit tricky.
It would probably be best to call the other macro, before the other macro ends
so..........
sub macro1()
'codewhatever
macro2
end sub
sub macro2()
'code whatever
macro3
end sub
Bookmarks