+ Reply to Thread
Results 1 to 3 of 3

how to assign a different macro to each*combobox selection in form control....

  1. #1
    Registered User
    Join Date
    08-02-2012
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    2

    Post how to assign a different macro to each*combobox selection in form control....

    Hi Everyone,

    I am very new to macros...Trying to assign a macro to a form control combo box. I've looked up information online, but I still cannot seem to get this to work.

    I inserted the combo box via Developer > Insert > Form Controls. Then I went to Format Control and selected the items via Input Range.


    I've tried selecting the*combobox*and assigning the macro but this only assigns one macro to the whole*combobox. So only the macro assigned runs no matter which item is selected in the*combobox.

    I have 7 different items to select from from the combo box. When each is selected, I want a different macro to run.
    and also i have recorded all 7 macros.

    But i dont knw how do I assign a different macro to each*combobox selection?

    Please help me all...

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: how to assign a different macro to each*combobox selection in form control....

    Assuming this ComboBox is named ComboBox1, you'll need to doubleclick that object to open the Vbeditor, and hopefully it is already showing you the Change module for that object:


    Please Login or Register  to view this content.

    This is a macro that triggers each time you change the selection on that combo box. Within this code, you'll test teh possible choices and run the macro desired:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: how to assign a different macro to each*combobox selection in form control....

    Hi,

    In the combobox macro include code like the following. For case "a", "b" etc, change to your seven drop down values

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1