+ Reply to Thread
Results 1 to 7 of 7

items in combobox2 depending on combobox1

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    Almere
    MS-Off Ver
    Excel 2003
    Posts
    48

    items in combobox2 depending on combobox1

    I'm looking for the correct If Then solution that can add items to combobox2 depending on the choice that's made with combobox1
    So combobox1 has three choices (X, Y, Z). When a user selects X, the 2nd combobox should display A, B and C.
    When a user selects Z in the first combobox, the 2nd should display G, H and I
    Hopefully I explained good enough what I'm looking for and can I expand a working situation myself with other options

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,841

    Re: items in combobox2 depending on combobox1

    Something like this? I was in a hurry so I used whatever came to mind instead of your letters.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    08-22-2012
    Location
    nj, us
    MS-Off Ver
    Excel 2010
    Posts
    163
    what happens when "y" is chosen?

    Depending combo boxes.xlsmHere is file
    i modified other guy's . imade it correct
    no errors!
    Last edited by JBeaucaire; 09-15-2012 at 10:01 AM.

  4. #4
    Registered User
    Join Date
    08-16-2012
    Location
    Almere
    MS-Off Ver
    Excel 2003
    Posts
    48

    Re: items in combobox2 depending on combobox1

    thx sofar for the help but is it possible to use this in a userform ??
    so when I press a button on Sheet1, the userform opens and inside this form there are the comboboxes visible

    Quote Originally Posted by john456852 View Post
    what happens when "y" is chosen?
    I'm still figuring out all the options that should be available but if I have a start I can modify all the options later myself
    Last edited by minifreak; 09-15-2012 at 10:09 AM.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: items in combobox2 depending on combobox1

    Hi, minifreak,

    the normal to attach to the button is simply the call the userform:

    Please Login or Register  to view this content.
    Behind the userform place the following code
    Please Login or Register  to view this content.
    Please alter the names to suit. Within the Select Case you can add other or more items if wanted.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Registered User
    Join Date
    08-16-2012
    Location
    Almere
    MS-Off Ver
    Excel 2003
    Posts
    48

    Re: items in combobox2 depending on combobox1

    Thx Holger,

    Now I see how the code needs to be written and how it works, I think I can use it very much to create a userform with comboboxes but also maby some more comboboxes
    You all helped me a lot !!

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

    Re: items in combobox2 depending on combobox1

    If that takes care of your question, please select Thread Tools from the menu above and mark the thread as solved. Thanks.
    _________________
    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!)

+ 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