+ Reply to Thread
Results 1 to 6 of 6

Populate UserForm ListBox with unique values from filtered data

  1. #1
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Populate UserForm ListBox with unique values from filtered data

    Hi,

    I want to create a UserForm to filter data, I start by doing like below to get the unique values of the data before it's being filtered:
    Please Login or Register  to view this content.
    The UserForm has 3 ComboBoxes where each for the YEAR, MONTH and DATE.

    The UserForm_Initialize works, as each ComboBox show the result correctly.

    With the codes below, I'm hoping that if (for example) I change the MONTH ComboBox value to (for example) "January" :
    1. it will filter the column MONTH in Sheets ("DATA") to "January"
    2. it will show each unique values of the filtered data for the column DATE of the Sheets "DATA" in the ComboBox DATE.
    3. it will show each unique values of the filtered data for the column YEAR of the Sheets "DATA" in the ComboBox YEAR.

    Please Login or Register  to view this content.
    I realize that the green code is wrong, as the ComboBox of DATE and YEAR is showing the same result from the UserForm_Initialize, because it seems the code reads from the whole rows (not the filtered rows) either in column Q or column B of Sheets ("DATA").

    My question is:
    How to get the unique values from the filtered data of column YEAR & DATE in Sheets ("DATA") and then populate them to the ComboBox ?

    Any kind of respond would be greatly appreciated.
    Thank you in advanced.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Populate UserForm ListBox with unique values from filtered data

    Could you upload an example file so that don't have to do everything from the beginning ?

  3. #3
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Populate UserForm ListBox with unique values from filtered data

    Quote Originally Posted by porucha vevrku View Post
    Could you upload an example file so that don't have to do everything from the beginning ?
    Sorry for my late reply.
    Attached is the sample file. It runs but it seems not perfect yet. Thank you porucha.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,075

    Re: Populate UserForm ListBox with unique values from filtered data

    Try this mod for both loops
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Populate UserForm ListBox with unique values from filtered data

    Quote Originally Posted by Fluff13 View Post
    Try this mod for both loops
    Please Login or Register  to view this content.
    I've tried that as seen in my attachement. Thank you Fluff13

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,075

    Re: Populate UserForm ListBox with unique values from filtered data

    You're welcome & thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Populate a Listbox with Unique data of filtered range
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-23-2018, 02:35 AM
  2. [SOLVED] Populate unique listbox values from combobox selection
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-29-2017, 05:34 PM
  3. [SOLVED] Populate a listbox with unique values from a range on a worksheet
    By D.Lovell in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-27-2014, 04:18 PM
  4. [SOLVED] Item in ListBox (search) to populate UserForm with values
    By onmyway in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-12-2013, 04:47 AM
  5. Multiple dependant filtered with unique values combo box in userform
    By dorman.castillo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-29-2013, 04:43 PM
  6. [SOLVED] populate userform with filtered data
    By crossy5575 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-2012, 11:47 AM
  7. Using Filtered Data in Userform Listbox
    By sfinney in forum Excel General
    Replies: 0
    Last Post: 03-18-2005, 11:09 AM

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