+ Reply to Thread
Results 1 to 3 of 3

Match 2 Values from Combobox on Sheet then populate combobox with 3rd column value

  1. #1
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Match 2 Values from Combobox on Sheet then populate combobox with 3rd column value

    Edit: I see now that I should have worded the subject as "Match 2 values from Combobox TO sheet..." The comboboxes are not on the worksheet itself, they are on a userform and need to match values on a worksheet.

    I have a userform that has 3 combobox on it that we use for an inventory.

    The first combobox "firstname" has a list of usersfirst names that it pulls from Column C on the worksheet.

    Based on what they choose for "firstname" it searches that column and anytime there is a match, it will add the value next to it from Column B to my second combobox called "lastname".

    This part all works fine, but this is where I run into a problem.

    Based on what is chosen for their firstname and lastname, I need to populate the third combobox "equiptype" with the value that is in Column A, assuming that Column C matches "firstname" and Column B matches "lastname".

    This has to be completely dynamic, as users can have more than one piece of equipment, which can change. This way we can choose a piece of equipment the user has without having to guess or refer back to the worksheet.

    I can't just match it to their first or last name, because we have multiple users with the same first or the same last names, and we have to have the first and last name separate columns. And each piece of equipment has to be on a different line.

    This is how I am populating the firstname and lastname comboboxes if it makes any difference (which works very slick):
    Please Login or Register  to view this content.
    To try to make things a little clear, here is an example:
    Column A (equipment types)
    A3- Phone
    A4- PC
    A5- Air Card
    A6- Cell Phone
    A7- Headset

    Column B (last names)
    B3- Smith
    B4- Doe
    B5- Thompson
    B6- Smith
    B7- Schmidt

    Column C (first names)
    C3- Mike
    C4- Paul
    C5- John
    C6- Mike
    C7- Mike

    So let's say I chose "Mike" for the firstname combobox and "Smith" for the lastname combobox, in the equiptype combobox I now want to see "Phone" and "Cell Phone".

    It's this equiptype combobox that is throwing me off. I can't figure out how to get it to match two pieces of criteria, and populate the third combobox.

    We have too many equiptypes and too many names to try to sort through what someone has or doesn't have, and it changes so frequently. So seeing just what they have would make the rest of the form so much smoother!

    Any help on getting the third dynamic combobox to populate would be great!
    Last edited by XLVBA; 09-14-2009 at 08:34 AM.

  2. #2
    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: Match 2 Values from Combobox on Sheet then populate combobox with 3rd column valu

    Heloo XLVBA,

    Welcome to the Forum!

    You can change this macro to suite your needs. It uses the names ComboBox1, ComboBox2, and ComboBox3 for the UserForm controls. They hold the last name, first name and equipment respectively. The worksheet is "Sheet1" and the range starts at "A3" to the last used cell in column "C". These are marked in red for easy identification. Here is the event code to load ComboBox3 after exiting ComboBox2.
    Please Login or Register  to view this content.
    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!)

  3. #3
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Re: Match 2 Values from Combobox on Sheet then populate combobox with 3rd column valu

    This works perfect. Thank you very much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1