+ Reply to Thread
Results 1 to 5 of 5

Filtering a multicolumn ListBox in a UserForm using ComboBox and TextBox

  1. #1
    Registered User
    Join Date
    11-20-2020
    Location
    Québec, Canada
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Question Filtering a multicolumn ListBox in a UserForm using ComboBox and TextBox

    Hello everyone,

    I'm (sorta) new to the forum, I come here anytime I need help with an issue but this is the first time I can't find a solution to my problem.

    I'm trying to find a way to filter a multicolumn ListBox with a ComboBox and a TextBox. Basically, the Listbox has different products in it, with brand, supplier and price for one unit. When my UserForm is initialized, the ListBox is populated with a range from another workbook. The ComboBox is to choose which column I want to filter, the TextBox is to enter the text I want to search (obviously ).

    I want the ListBox to be updated everytime I add a character to the TextBox (TextBox_change I guess)

    I know I need an If ComboBox.value = "Brand" Then... but I don't know how to search the ListBox in this exact column or how to remove the items that don't contain the text searched.

    I also need the ListBox to revert to the full list if I clear the TextBox. Probably just need a line with ListBox.List = range with some conditions in the TextBox_Change

    Any ideas on how I can do this?

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Filtering a multicolumn ListBox in a UserForm using ComboBox and TextBox

    Here are a couple of threads that may help

    Filter Listbox Values based on Textbox input


    TextBox real time filter for ListBox
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    11-20-2020
    Location
    Québec, Canada
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: Filtering a multicolumn ListBox in a UserForm using ComboBox and TextBox

    Thank you AlphaFrog for the quick response!

    I think that the second link might work if I can find a way include my ComboBox in the mix. Definitely going to check it out

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,295

    Re: Filtering a multicolumn ListBox in a UserForm using ComboBox and TextBox

    A couple of methods - one filters on individual columns - other one filters by cascading comboboxes (only relevant searches are past to the next combobox.
    torachan.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-20-2020
    Location
    Québec, Canada
    MS-Off Ver
    MS Office 2013
    Posts
    19

    Re: Filtering a multicolumn ListBox in a UserForm using ComboBox and TextBox

    Alright! I did some digging with the suggestion AlphaFrog gave me and I came up with this.

    Please Login or Register  to view this content.
    The ListBox2 is used as a header. I run a piece of code that aligns the columns with those in ListBox2. I don't have to use labels this way.

    I summarize the If ComboBox1.value = "..." with a For Loop to avoid repeating every if lines.

    The sub runs pretty smoothly for what I need. Still have to try with lots and lots of lines (I only have a couple hundreds lines in my ListBox1)
    Last edited by nightseeker; 12-04-2020 at 05:38 AM.

+ 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. Populate TextBox with certain line of a MultiColumn ListBox Value
    By abulkhairi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-28-2018, 03:46 PM
  2. Filter UserForm Multicolumn ListBox with TextBox/ComboBox
    By Alex.riccio in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-07-2016, 03:12 PM
  3. Filter UserForm Multicolumn ListBox. populated by RowSource. with TextBox/ComboBox
    By Alex.riccio in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-07-2016, 10:19 AM
  4. [SOLVED] Filter UserForm Multicolumn ListBox with TextBox/ComboBox
    By Alex.riccio in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2016, 04:31 PM
  5. Help with filtering Multicolumn Listbox
    By yoursamrit2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2015, 09:40 PM
  6. [SOLVED] Filtering a Listbox with a textbox in a userform
    By Aris in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2014, 06:16 AM
  7. Loading MultiColumn Combobox in a Userform
    By anandvh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-22-2014, 10:47 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