+ Reply to Thread
Results 1 to 10 of 10

Filter Data in userform ListBox

  1. #1
    Registered User
    Join Date
    10-25-2014
    Location
    Walsall, England
    MS-Off Ver
    2010
    Posts
    39

    Filter Data in userform ListBox

    Hi There

    I have been learning a lot of code since I started in this Forum, but I'm still quite newbie with ListBoxes. I have a clue already but I don't seem to understand the logic between the code to make things working. For that reason, I was wondering if you guys could help me with something. On my attached sample, all I need is this: text in "Sage code" Text box then listBox shows all the rows with column A matching. If I add "Part number ", it will show me all the rows with those 2 criteria and the third textbox the same. Finally, once button "pick 1" pressed, it will take 1 to the original quantity and update the cell automatically of the selected row. Is it possible/ Easy?


    Many Thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Filter Data in userform ListBox

    Im not able to open your download at the moment but a basic Sub to populate a listbox is something like.....

    Please Login or Register  to view this content.
    Which will run through A1:A1000 searching for values that match your criteria in the textbox, when it finds one, it adds the value of column B to the Listbox.

    i dont think you can then filter a listbox, what I usually do is clear it and run the code again with the additional criteria so you're basically rebuilding the listbox every time.
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Filter Data in userform ListBox

    It is a start, Search, Pick 1, Delete Row, and exit without changes are working.


    Kind regards
    Leo
    Attached Files Attached Files

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Filter Data in userform ListBox

    You could also filter in listbox.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-25-2014
    Location
    Walsall, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Filter Data in userform ListBox

    Hi Leo

    that is perfect for what I need, thanks. There is an error there is no match on the searchbox, but I can handle that, no worries. Thanks a lot for your quick and awesome reply.

  6. #6
    Registered User
    Join Date
    10-25-2014
    Location
    Walsall, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Filter Data in userform ListBox

    Hi Bakerman/ PJ

    it works lovely but for my purposes, I chose Leo's one. although, your solution will be used by me as well in other workbooks I have Thank you all for your help.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Filter Data in userform ListBox

    Thanks for the rep

  8. #8
    Registered User
    Join Date
    10-25-2014
    Location
    Walsall, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Filter Data in userform ListBox

    Hi Leo

    Apparently, I'm not being able to remove the error. My knowledge is still not enough. I have everything working already and there's nothing else I want to add. It is perfect for my needs. The only thing I would like is to remove this error (if there's no match on the textboxes, it gives me the 1004 error). what I would like is to simply show nothing if there's no match. I could survive with that but the problem is that more people will work with that form and they will be stuck if that happens.
    Again, thanks for all your help.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Filter Data in userform ListBox

    Hi Tony,

    now there will be a msgbox when there is no match
    and delete row, deletes the row in listbox also


    Kind regards
    Leo
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    10-25-2014
    Location
    Walsall, England
    MS-Off Ver
    2010
    Posts
    39

    Re: Filter Data in userform ListBox

    Thanks Leo. That is perfect Can't thank you enough!!!

+ 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. Filter listbox in userform - VBA
    By mopan in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-18-2015, 04:36 AM
  2. Using ComboBox on Userform to filter ListBox
    By burger160 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-17-2014, 05:03 PM
  3. [SOLVED] Filter worksheet data using 4 dependant comboboxes and populate in 'ListBox' on a userform
    By p_nayak268 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-27-2014, 12:41 PM
  4. Transfer Data From One Userform Listbox to Another Userform Listbox with 11 columns
    By sparkoft in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-18-2013, 10:54 AM
  5. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM

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