Macros in a drop down list

Microsoft Excel
Microsoft Excel macros
How can I get macros into a data validation list so I can select a macro to run from that list.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Are you referring to assigning a number of macros to one cell & then select from the Drop down list? This is a bit complicated & will require additional VB codes referencing to that cell.

I am assuming you have written a number of macros & now want to assign the macros to various cells. For Excel 2007 … the simplest way will be:
1) Click on your designated cell, Then click on the Tab Insert & then click Shapes. Select the first cell Under Callout.
2) Now click on the designated cell. The Callout structure will appear. You can size it by dragging the “Handles”. Type the macro name or other info on the CallOut space.
3)Now right click on the cell & select Assign Macro. Select the Macro you want to associate with this cell.
4)Move away from the cell & then click again on the cell.
5)Your assigned macro should execute.

Discuss This Question: 4  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Excerlnovice
    Thank you for sharing the information and proposed solution. What I am trying to do is use a drop down list to select macros to run from. For example, I have 12 macros, 1 for each month, and instead of creating buttons and assigning a macro to each individual button I want to have a drop down list in the form of a data validation list that lists each month. Each of those selections would be each of the macros that I want to run when selected. This would be a list of January through December. When I click on the cell that has the drop down list and all twelve months appear in the list I would select the month that I want to run the macro for, such as January. The January macro would then run, then February where when February was selected it would run the February macro and so on.... I have seen a spreadsheet where this was done as a demo but I have yet been able to duplicate it. Thank you,
    15 pointsBadges:
  • Cdogg
    By chance is there a resolution? I have a Validation List Drop Down that I want to fire a Macro to change another drop down when it changes so the 2 drop downs are equal. Do you have any suggestions?
    10 pointsBadges:
  • DoneThat
    I think ExcerInovice wants the choice selected in the Listbox to BE the macro to be executed. Here is an approach (any of the real VBA gurus can step in here with specifics) A Listbox simply changes the content of a cell. You can code a "master" VBA sub to run on that change event. It could be as simple as a CASE statement calling the appropriate macro based on the cell's content. A bonus will be that the Listbox content can be descriptive vs. the actual macro name which would be internal only. A sample of a more basic approach can be found here... Gary
    830 pointsBadges:
  • Smf
    I would add a CommandBarControl then add msoControlButton for each macro. Giving the msoControlButton the appropriate Name. You can save this into an .xla or keep within this one spreadsheet.
    170 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: