How to activate a macro from combo box
I am using Office 2007 where i had created a file in Excel, where i want to know that how can i activate a macro from a combo box. At the same time i had created a list of names in Combo box and also created a list of macros with the same name. Now i want that whenever i chose any macro from the list, it should activate the macro ?
Activate a macro from combo box
T to use the bloe code in combo box hope it works for you
Code:
Select Case ComboBox1.Value
Case "A1"
Call A1
Case "B1"
Call B1
Case "C1"
Call C1
Case "11"
Call ONE1
Case "22"
Call Two2
Case "33"
Call Three3
End Select
How to activate a macro from combo box
Thank you for replying me but can you tell me where should i put this code because i don't have any idea about it ?
Code:
Select Case ComboBox1.Value
Case "A1"
Call A1
Sub A1()
'
' A1 Macro
'
'
ActiveWorkbook.Save
Range("M8:Q17").Select
Selection.ClearContents
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
Range("Z1:AD9").Select
ActiveWindow.ScrollColumn = 6
Selection.Copy
ActiveWindow.LargeScroll ToRight:=-1
Range("M8").Select
ActiveSheet.Paste
Range("A3").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub
How to activate a macro from combo box
Can you tell me from where you had made your combo box, if you had made from View, then you need to have Control toolbar from View then goto green triangle icon and get your combo box in Design mode, after that you need to hold the cursor over the Combo box and right click on it and select Properties, Find "ListFillRange" enter the Range with you Macro names in i.e.. A1:A5 Double Click the Combo box, or right click and select "View Code". Paste the code into the window, between "Private Sub ComboBox1_Change() " and "End Sub". to end up
How to activate a macro from combo box
Thank you for replying me i had pasted the code where you had said me but when i am trying to run the macro over there i am gettign an error message as
Run-time error '1004':
Unable to get the DropDown property of the worksheet class
Can you tell me where i had made mistake.
Re: How to activate a macro from combo box
In that case i would suggest you to add the following code too in your code and hope it works for you
Code:
Sub DropDown141_Change()
With ActiveSheet.DropDowns(Application.Caller)
Application.Run .List(.ListIndex)
End With
End Sub