+ Reply to Thread
Results 1 to 5 of 5

Inter-relating Combo Boxes in Userforms based on data in tables

  1. #1
    Registered User
    Join Date
    10-04-2009
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    77

    Exclamation Inter-relating Combo Boxes in Userforms based on data in tables

    Hi Everyone,

    I was wondering if any of you lovely lovely people could help me at all?

    I have worked out (through reading and what not) how to link a combo box to a range in a worksheet.

    What I need to do is relate what is selected in that combo box, to another combo box which picks from another range.

    I'll explain.

    Basically I have a data spreadsheet called "Offices"

    It's set up as follows

    (Sorry, it's really frustrating trying to format it to a table type thing but you get the gist)

    ROW NUM______COLUMN A____________COLUMN B
    ---------------------------------------------------------------
    [email protected]
    ---------------------------------------------------------------
    2_________________________________OFFICE 1
    3_________________________________OFFICE 2
    4_________________________________OFFICE 3
    5_________________________________OFFICE 4
    ---------------------------------------------------------------
    [email protected]
    ---------------------------------------------------------------
    7_________________________________OFFICE 2
    8_________________________________OFFICE 3
    9_________________________________OFFICE 4


    The dashed lines just show borders around cells so you can split them up.
    The solid lines i've had to put in to space it out...
    Column B rows 2 to 5 are named as range "DistrictOffice1_List" and Column B rows 7 to 10 are named as range "DistrictOffice2_List"

    Now, in my userform, lets say its called "InputScreen".
    I have a combo box called "DistrictOffice" and below that I have "Office"

    I want the DistrictOffice combo to show all the district offices to pick from column A excluding any cells that aren't filled in i.e. rows 2-5 and 7-9.

    Then I want the Offices combo box to automatically populate with all the offices for that DistrictOffice sourced from column B i.e. based on DistrictOffice selected so that if "DistrictOffice1" were selected in the "DistrictOffice" combo, the "Offices" combo only shows "OFFICE5, OFFICE6, OFFICE7".

    If anyone can help that would be amazingly helpful!!! Thanks in advance :-)
    Last edited by Smurlos; 10-04-2009 at 01:31 PM.

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Inter-relating Combo Boxes in Userforms based on data in tables

    HI, and welcome to the forum. If you could attach a copy of you workbook. It probably would be easier for the members to see what you are trying to accomplish.
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  3. #3
    Registered User
    Join Date
    10-04-2009
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: Inter-relating Combo Boxes in Userforms based on data in tables

    Thanks for the welcome Charles.
    Spreadsheet is attached. Sorry for the delay, I've had to edit it as it had real Offices and logos and what not in it as it's based on a company.

    Cheers
    Carl
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Inter-relating Combo Boxes in Userforms based on data in tables

    Hello Smurlos,

    Welcome to the Forum!

    I have added the code below to the attached workbook. I changed you listing on the "Offices" worksheet by separating each Office Group with a blank line. This is not only provides better eye train on the form, it is also makes programming easier.

    User Form InputScreen Code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Registered User
    Join Date
    10-04-2009
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: Inter-relating Combo Boxes in Userforms based on data in tables

    That is fantastic, Leith, you've no idea how much that has helped! Thank you so so much! Life saver!

+ 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