Results 1 to 6 of 6

Thread: How to activate a macro from combo box

  1. #1
    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 ?

  2. #2
    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

  3. #3
    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

  4. #4
    Join Date
    Apr 2008
    Posts
    3,267

    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

  5. #5
    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.

  6. #6
    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

Similar Threads

  1. Replies: 4
    Last Post: 29-06-2013, 11:03 AM
  2. Replies: 8
    Last Post: 01-12-2011, 08:58 PM
  3. Reliance 649 combo VS Airtel 699 combo
    By Anish-Mumbai in forum India BroadBand
    Replies: 5
    Last Post: 05-05-2010, 09:45 AM
  4. Dvd vhs combo
    By Theo in forum Hardware Peripherals
    Replies: 3
    Last Post: 04-08-2009, 12:55 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,517,117.68716 seconds with 17 queries