+ Reply to Thread
Results 1 to 4 of 4

Using ComboBox on Userform to filter ListBox

  1. #1
    Registered User
    Join Date
    04-01-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    4

    Using ComboBox on Userform to filter ListBox

    Hi All,

    I have a list of products in a spreadsheet that I want to be able to filter on a Userform. Ideally, I would like all products to appear in the ListBox to begin with, and then based on a selection made in any or all of the ComboBox, I would like it to then filter the ListBox to critera that is selected.

    I know that there are a couple of examples on this forum that do what I'm after, however after trying for a few days I have no idea how to re-code into my spreadsheet as I'm a bit of a noob when it comes to VBA.

    I've attached a copy of the spreadsheet and the Userform if someone can help.CODETEST.xlsm

    Regards,

    Burger

  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,259

    Re: Using ComboBox on Userform to filter ListBox

    Hello burger160,

    This was quite a challenge. Good news it that the attached workbook is functioning correctly.

    At the top of each ComboBox is the choice "Select All" which allows the user to remove the filtering on that column only. The remaining filters are unaffected.

    The ComboBox will change color from white (Select All) to Yellow (filter choice). This provides a visual indicator to the user which columns have filtering applied.

    Each Combox lists the unique entires for it's column in ascending alphabetical order. Each time a choice is made the ListBox is updated.

    Try this out and let me know what you think about it.


    Here is the code for the macro to sort the ComboBox.

    Sort And Remove Duplicates From CombBox Macro 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!)

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

    Re: Using ComboBox on Userform to filter ListBox

    Hello burger160,

    After a little testing I found a problem. A single row would not display correctly. I fixed that problem and also reduced the flickering when the UserForm is loading.

    NOTE: Please use this version of the workbook for testing and evaluation.
    Attached Files Attached Files

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Using ComboBox on Userform to filter ListBox

    Hi burger160

    As did Leith, I found this to be a bit of a challenge. As I've spent considerable time on the effort I'm offering a proposed solution to MY intrepretation of the issue as you described it.
    Ideally, I would like all products to appear in the ListBox to begin with
    and this
    based on a selection made in any or all of the ComboBox, I would like it to then filter the ListBox to critera that is selected
    I acknowledge, my interpretation of the issue may be way off base. But, there you go.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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] Filter a listbox with a combobox and seach button
    By chin67326 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-04-2014, 03:37 AM
  2. [SOLVED] Changed userform combobox to listbox, unable to get userform to retrieve datasheet values
    By dragonabsurdum in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2013, 01:38 PM
  3. UserForm listbox/combobox
    By adeleex in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-25-2011, 03:54 AM
  4. Userform One or more options listbox? combobox?
    By starcraftbud in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2010, 11:44 AM
  5. UserForm;comboBox,ListBox
    By samsara in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-03-2009, 06:13 AM

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