+ Reply to Thread
Results 1 to 7 of 7

Advanced searching in listbox

  1. #1
    Forum Contributor
    Join Date
    10-18-2018
    Location
    Amsterdam, Holland
    MS-Off Ver
    2013
    Posts
    104

    Advanced searching in listbox

    Hello all,

    I made a little excel to search for employees and their data, see attached.

    On the sheet Dashboard there is a button, if you click on it the form opens.

    In quick search you can type everything and it searches.


    The problem:

    When i want to display only shift A and type A in quick search it displays everything with an "a" in it.

    Anyone knows how can i add advanced search? So when i type A behind Shift it only displays the people that are in Shift A?
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Advanced searching in listbox

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    10-18-2018
    Location
    Amsterdam, Holland
    MS-Off Ver
    2013
    Posts
    104

    Re: Advanced searching in listbox

    That works, thank you!

    Where in the code do you specify in which column it looks?
    I would like to use this code also for other textboxes like function or area.

    If i type on the textbox and delete it the full list doesn't return.
    What do i add so that if i make the textbox empty the full listbox returns?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Advanced searching in listbox

    The 3 here specifies the column to check for the shift.

    You can add an Else clause to restore the contents of the listbox if you clear the textbox or no matches are found.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-18-2018
    Location
    Amsterdam, Holland
    MS-Off Ver
    2013
    Posts
    104

    Re: Advanced searching in listbox

    Each answer of you helps me futher, thank you very much for your time.

    Probably my final question: Is it possible that it continues with searching;
    For example, i search on Shift A and get results, when i type in Function Tech I it filters out the Tech I out of the people in Shift A.

    Now it "restarts" searching.

    Thanks in advance.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Advanced searching in listbox

    For that you should load an array with the current contents of the listbox and run the filtering code on that.

    To load an array from the listbox you can use something like this.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    10-18-2018
    Location
    Amsterdam, Holland
    MS-Off Ver
    2013
    Posts
    104

    Re: Advanced searching in listbox

    Will look into it.

    I notice that the list doesn't return properly when there are empty cells under shift or function.
    Is it possible that the code ignores empty cells and returns the full list properly?

    Edit: i see what happens. When i empty the cell Shift or Function it returns all cells that have no value.
    Is it possible to not return all empty cells but just reset the listbox when i empty the textbox Shift or Function?
    Last edited by Bandito1; 02-08-2019 at 02:10 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. Textbox gets wrong value after searching the listbox
    By r.visser88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-15-2017, 05:58 AM
  2. Advanced Filter displayed on Userform's Listbox
    By brainzlp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-07-2016, 04:57 AM
  3. Advanced searching problem (names)
    By Karl-Oskar in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-21-2015, 03:30 AM
  4. Need help with advanced listbox data setting
    By SoulPrisoner in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-29-2013, 03:49 AM
  5. Advanced filtering, searching for a unique word
    By Yoruichi in forum Excel General
    Replies: 11
    Last Post: 04-29-2010, 07:21 PM
  6. [SOLVED] Advanced Searching
    By Josh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2006, 04:10 PM
  7. Replies: 15
    Last Post: 03-02-2005, 01:06 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