MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Using a drop down list to select a macro to run


Posted by Richard H on July 24, 2000 6:02 PM

I wish to write a macro with a dropdown list. When I select an item form the list, a macro would run. The concept I have in mind is not unlike the menu macro in the old Lotus 123 where you select a menu item and a macro runs. Thanks in advance, Rich


Posted by Ryan on July 25, 0100 10:42 AM

Rich,

You will need to set up a userform, and add a list box on it, fill the list box, add a command button to the userform and and add code to execute whatever macro you want to run based on the listbox item selected. It might look something like this:

Sub CommandButton1_Click ()
Select Case ListBox1.Value
Case "Macro1"
Call Macro1
Case "Macro2"
Call Macro2
And so on....
End Select
End Sub

Hope this helps!

Ryan