+ Reply to Thread
Results 1 to 5 of 5

Cascading Userform Comboboxes with Unqiue List

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    4

    Cascading Userform Comboboxes with Unqiue List

    Hello All,

    I am using a userform to allow users to select an option from 2 comboboxes (titled “SrchPackage” and “SrchComponent”). The list in the 2nd combobox, “SrchComponent”, is based on the user’s selection from the 1st combobox, “SrchPackage”.

    My dataset is as follows:
    ColA ColB
    A Blue
    A Blue
    A Yellow
    B Red
    B Yellow
    B Red
    Upon userform initialisation, I use the following code to populate the 1st combobox (named “SrchPackage”) with unique values from the dynamic range in ColA, also named “SrchPackage”. This code works fine.

    Please Login or Register  to view this content.
    Based on the dataset above, combobox “SrchPackage” would return:
    A
    B

    If a user was to select “A”, the list in the 2nd combobox, “SrchComponent”, ideally would return the unique values from “ColB corresponding to the value “A”, i.e.:
    Blue
    Yellow

    But, I’m having trouble with the ‘unique’ part. With the code I’m currently using below, the list generated for the 2nd combobox appears as:
    Blue
    Blue
    Yellow

    Here is the code I’m using for the Combobox “SrchPackage” change event: (the range “vlup” is a dynamic named ranged for ColA).

    Please Login or Register  to view this content.
    Your assistance with the issue of not being able to generate a unique list of entries in the 2nd combobox is greatly appreciated, thank you.

    Ronjay24

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Cascading Userform Comboboxes with Unqiue List

    Try this,

    Please Login or Register  to view this content.
    Last edited by JapanDave; 09-02-2012 at 09:27 PM.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Cascading Userform Comboboxes with Unqiue List

    Ronjay24

    See if the attached is what you are after
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-29-2012
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    4

    Re: Cascading Userform Comboboxes with Unqiue List

    JapanDave & jindon,

    Thank you both for your solutions - both worked as intended. I decided to go with JapanDave's, as I was able to simply copy their code into my workbook. I had to ensure that the variable "j" was dimensioned as a Variant and not a Long.

    Cheers,
    Ronjay24

  5. #5
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Cascading Userform Comboboxes with Unqiue List

    No worries Ronjay. "j" should also work being dimension-ed as a range.

+ 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