Uniqe values in listbox an include associated rows (Userform VBA)

  • Hi


    There is a lot of topics on the web, how to get unique values from a excel worksheet, into a listbox in Userform
    All is about single column listbox.

    My problem is after I found the unique values I also want to display the entire row off the corresponding data (All columns just not three as in this example).

    I have created a test table I based on four columns and 10 rows.
    Column A (ID) is a
    concatenated column (data from column B and C). And this column I find my unique values. Se Pic.A
    Data from column D is not going to be included in the list box.

    The result I’m looking for is shown in Pic.B
    My column widths is (0pt;50pt;50pt)
    Column index 0 is not be shown for the user.
    But in pic.B the column is not “hidden”.



    I’ve tried various vba code and tried to combine the rest of the column into the code.

    But now I’m stuck.


    Hopefully there is some bright minds out there and which has the right (or some) solution




  • The simplest way would be to Use AdvancedFilter with some VBA to move the ubique data to a different location then use the temporary data to load the ListBox. My website has a page with examples of loading unique values to a ComboBox with an example workbook.


    Add A List of Unique Values to a Combo Box


    The example using AdvancedFilter cab be easily adapted for what you want.