Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to activate a macro from combo box

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 25-02-2010
Members
 
Join Date: May 2009
Posts: 45
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 ?

Reply With Quote
  #2  
Old 25-02-2010
Member
 
Join Date: Jan 2009
Posts: 141
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
Reply With Quote
  #3  
Old 25-02-2010
Members
 
Join Date: May 2009
Posts: 45
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
Reply With Quote
  #4  
Old 25-02-2010
Member
 
Join Date: Apr 2008
Posts: 3,261
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
Reply With Quote
  #5  
Old 25-02-2010
Members
 
Join Date: May 2009
Posts: 45
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.
Reply With Quote
  #6  
Old 25-02-2010
Member
 
Join Date: Dec 2008
Posts: 104
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to activate a macro from combo box"
Thread Thread Starter Forum Replies Last Post
Best plan between BB Home Combo ULD 750 and BBG FN Combo 500 of BSNL TECHi India BroadBand 4 29-06-2013 12:03 PM
Which plan is good BSNL plan from BBG FN Combo 600 or BB Home Combo UL 750? SupaBoy India BroadBand 8 01-12-2011 08:58 PM
Reliance 649 combo VS Airtel 699 combo Anish-Mumbai India BroadBand 5 05-05-2010 10:45 AM
Dvd vhs combo Theo Hardware Peripherals 3 04-08-2009 01:55 PM


All times are GMT +5.5. The time now is 05:31 AM.