+ Reply to Thread
Results 1 to 10 of 10

displaying text box search results in a listbox

  1. #1
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    displaying text box search results in a listbox

    I am trying to create a search where the user types into the text box 'ItemDescription' then hits the 'ItemDescSearch' button (see below code) to pollute the list box 'lbSamDesc' with any partial matches from the specified range. Currently when I click on the button it takes about 8 seconds then no results are displayed in the List Box. What am I doing wrong?

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,788

    Re: displaying text box search results in a listbox

    Impossible to know without seeing your data.

    Although your code may work (I don't see anything obviously wrong with it), you are combining two methods that are not optimal when used like this. Find is very powerful for finding matches in an entire range of cells, but you are using Find one cell at a time. The following modification should speed things up but I can't tell why your code doesn't work without seeing your data, and I can't do a decent test without your file. I suggest you attach it.

    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: displaying text box search results in a listbox

    Thank your for the response.
    I tried that code but it still doesn't seem to do anything for me. However I did notice that whatever it is doing it only took a second (verses the last code taking several).
    I have attached a sample workbook with the data and userform.

    Thanks,
    James
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: displaying text box search results in a listbox

    Any thoughts Jeff?

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,788

    Re: displaying text box search results in a listbox

    Couple of bugs in the code, my fault. Providing your file made it possible to diagnose and resolve.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: displaying text box search results in a listbox

    Thanks Jeff that worked great (sorry I should have provided a file from the beginning).
    Is it possible to have it remove the duplicates from the results?

    Cheers,
    james

  7. #7
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: displaying text box search results in a listbox

    adapted from
    http://j-walk.com/ss/excel/tips/tip47.htm


    Please Login or Register  to view this content.
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,788

    Re: displaying text box search results in a listbox

    Nice code humdingaling--but Nitefox, wouldn't it be easier to just filter out duplicates from the original data?

  9. #9
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: displaying text box search results in a listbox

    Thanks humdingaling that did it.

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: displaying text box search results in a listbox

    Thanks both

    agree with 6string
    would be much easier to just clean original data set of duplicates

    especially if you are going to branch out off this for other parts of potential project

+ 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] Search for Text and displaying the results
    By ymaster44 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2014, 12:20 PM
  2. [SOLVED] [Help] I need search results in listbox reversed
    By Compo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-11-2013, 07:22 AM
  3. Search Results displayed in a Listbox
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-01-2011, 08:49 AM
  4. displaying search results after searching 2 cbo's
    By ncaravela in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-31-2010, 08:19 AM
  5. Displaying Search results (filtering?)
    By Klok in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-04-2009, 06:45 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