Hi, As "shg" so knowledgeably pointed out, you don't need all that code if you just need to run a "Macro" from a Combobox when the Macro name is the same as the Combobox Box value.
If you combobox came from the "View" , "Control Toolbar" then do the following:-
Get the "Control Toolbar" menu on the sheet from "View"--.
Click the Green triangle icon, this gets the Combobox in Design Mode,
When you hold the cursor over the "ComboBox" the Cursor changes to Arrow Headed Cross.
Right Click Select Properties, Find "ListFillRange" enter the Range with you Macro names in i.e.. A1:A5
Double Click the Combobox, or right click and select "View Code"
Paste the code into the window, between "Private Sub ComboBox1_Change() " and "End Sub". to end up as shown below:-.
Click the Green Triangle on the VB Window "Toolbar"
This will turn the blue square to it's left Dark Blue. You are now in run mode.
Close VB Window.
Now when you select a value in your ComboBox the related "Macro" will run. (Hopefully)
---------
If you have a Combobox from the from the "forms" Menu then do the following:-
Right click, choose "Format Control", "Control", enter range as above in "Input Range"
Close "Format control"
Right click, Combobox (DropDown Box), choose, "Assign Macro".
Select you "Drop down Box" from the Menu, if New choose "New" else choose "Edit".
Paste the following into the VB window after the words :- "Sub DropDown?_Change()"
and before "End Sub"
Close VBWindow.
On selection of ComboBox value the chosen "Macro will run.
Hope that's everything
Regards Mick
Bookmarks