+ Reply to Thread
Results 1 to 26 of 26

Shortcut for the "search" option in filters

  1. #1
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Shortcut for the "search" option in filters

    Edited to clarify - I use the little search feature in Excel's filters in order to search for an item on my filtered list. See image attached. What I'm hoping is that there's a way to reach this filters search bar without needing to click the down arrow every time.

    Does anyone know if there's a way to create a shortcut for the search bar when a filter is active? I'm hoping there's a way I can create a search bar where you don't need to click the down arrow of the filter every time. I have many columns in my spreadsheet so obviously we would need to specify what column to search and filter by. I'm probably asking for too much but if there was a way to make it dynamic as well that'd be the bees knees!
    Attached Images Attached Images
    Last edited by cpFAL96; 03-01-2022 at 03:08 PM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Shortcut for the "search" option in filters

    Here is one suggestion. Add the AutoFilter icon to the Quick Access Toolbar (QAT)

    https://www.mrexcel.com/excel-tips/f...Click%20OK.%20
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    You misunderstand. I don't want to search Excel for the filter option. I want to search WITHIN the filter option.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Shortcut for the "search" option in filters

    Nothing that I'm aware of.

  5. #5
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    Darn. No VBA code or anything?

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Shortcut for the "search" option in filters

    If it's possible, I'm afraid I don't know it.

    I've placed a call for help with this thread. Hang tight, maybe somebody has an idea.
    Last edited by jeffreybrown; 03-01-2022 at 03:37 PM.

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Shortcut for the "search" option in filters

    Alt + ↓ then hold ↓

  8. #8
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,206

    Re: Shortcut for the "search" option in filters

    While working on a similar topic, I found out that MS did not provide programming access to the window shown. Probably the use of SendKeys remains, although I prefer the more difficult but sure way with keybd_event (Win API).
    I present the full module provided by Kevin Wilson. I have disabled anything unrelated to the current task.
    You must assign the Ctrl + q keyboard shortcut to the FindInAutoFilter procedure. Any other can be assigned as long as the appropriate code snippet is modified.
    Please Login or Register  to view this content.
    Artik

  9. #9
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    Thanks Artik! But I'm getting a compile error, code needs to be updated for 64-bit systems.

  10. #10
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,206

    Re: Shortcut for the "search" option in filters

    Replace the previous fragment regarding the declaration of the Win API function with the following:
    Please Login or Register  to view this content.
    It should work in both bit versions of Office.

    Artik

  11. #11
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Shortcut for the "search" option in filters

    Hi there,

    This probably isn't what you're looking for, but if the Advanced Filter method does what you need you could try the following approach.

    Cells A2:A101 contain the letters A to Z in random order.
    Cells C1:E1 are the defined name range "ptrFilterValues" and (at present) contain the values Q, J and Y.

    The following code will filter column A to show only those cells whose values correspond to the values in Cells C1:E1:

    Please Login or Register  to view this content.

    Hope this might be of some interest/help.

    Regards,

    Greg M
    Attached Files Attached Files

  12. #12
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Shortcut for the "search" option in filters

    Hi again,

    If you want an AutoFilter "lookalike" which displays a dropdown list of filter values, you could try the following approach which uses a defined named range "jotter" column to prepare the dropdown list:

    Please Login or Register  to view this content.

    Hope this helps.

    Regards,

    Greg M
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    Greg, I really like the first bit of code. It works great on your sheet and is exactly the kind of thing that would make my life easier! But I'm having trouble applying it to my sheet. Excel is throwing compile errors and error 400. I'm a VBA newbie (use it a lot but couldn't write anything beyond basics) so I'm probably goofing up something simple.

  14. #14
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Shortcut for the "search" option in filters

    Hi cpFAL96,

    While it appears Greg is away right now, I'll throw a few things in he may ask.

    1) What does the code debug too
    2) Can you provide a sample workbook of what you've tried

  15. #15
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    Here's the file I'm working with. It contains a list of over 1000 clients (obviously I've revised this version of the sheet) that I need to enter data for and I'd like to simplify searching and filtering for clients on the list.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    Quote Originally Posted by jeffreybrown View Post
    Hi cpFAL96,

    While it appears Greg is away right now, I'll throw a few things in he may ask.

    1) What does the code debug too
    2) Can you provide a sample workbook of what you've tried
    Thanks Jeffrey. It's been throwing the 400 error with no description. When I debug there's no issue, but when I try to run the code the error pops up.

  17. #17
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Shortcut for the "search" option in filters

    The error throws because you have not defined a name range called >> ptrFilterValues

    Open the VBA code and step thru the Sub FilterColumn by placing your cursor in the Sub and then pressing F8

    I'm not all that sure from the spreadsheet what you are trying to filter

  18. #18
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    Quote Originally Posted by jeffreybrown View Post
    The error throws because you have not defined a name range called >> ptrFilterValues

    Open the VBA code and step thru the Sub FilterColumn by placing your cursor in the Sub and then pressing F8

    I'm not all that sure from the spreadsheet what you are trying to filter
    Oh duh, of course. But it's still not quite working. See attached. It's trying to filter but not leaving the filtered rows visible, if that makes sense.
    Attached Files Attached Files

  19. #19
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Shortcut for the "search" option in filters

    Hi again,

    From jeffrey:


    I'm not all that sure from the spreadsheet what you are trying to filter

    I'm afraid that I'm in the same boat - I can't really figure out what you're trying to filter.


    Just for information, the code you're using to show/hide the various groups of columns can be greatly simplified. In the attached version of your workbook, the SAME "ShowSelectedName" routine is called by each of the 18 "Name" buttons on the worksheet.

    The following code will replace all of your "S1" to "S20" routines:

    Please Login or Register  to view this content.

    If you can give me a bit more information about how you want to filter the worksheet rows I'll see what I can do to help.

    Regards,

    Greg M
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    Thanks Greg! I wrote all those "name" codes myself so you can tell exactly what an amateur I am, lol.

    I'm trying to filter by client name. Essentially what I want to be able to do is type a portion of the client's name in the cell (A10) and have it filter out all clients that have that string of text in their name.

  21. #21
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Shortcut for the "search" option in filters

    Hi again,

    Thanks for your feedback.

    The attached version of your workbook contains an ActiveX TextBox control in Cell A10. Typing some/all of a Client code into this TextBox will hide rows whose Client codes do not correspond to the value entered. Clearing this TextBox will display all rows.

    The following code is inserted into the VBA CodeModule of the "ClientStats" worksheet:

    Please Login or Register  to view this content.
    The highlighted values may be changed to suit your requirements.


    Hope this helps - as before, please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files
    Last edited by Greg M; 03-04-2022 at 04:29 PM. Reason: Typo corrected

  22. #22
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    Hi Greg, sorry for not replying, I've had a super busy week.

    I had the chance today to look at your code and it worked great for your sheet, unfortunately when I applied it to mine, it's not working. The only difference in my sheet - as far as I can tell - is that I have 1300+ clients listed. I updated the "i_MAX_NO_OF_CLIENTS" value to 1500 but otherwise I just copied and pasted your code into the appropriate modules. I'll post my Excel sheet shortly.

    Side note but I also did notice the filter only works if I type the first characters of the name. It won't search within a string of text. (Like if I had "ABC Car Wash" I couldn't search for "car" and have it show.) Not the end of the world, this is already great, but do you know if there's a way to have it do this?

  23. #23
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    Sorry, my file is too big to upload.

  24. #24
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Shortcut for the "search" option in filters

    Hi again,

    Did you incorporate the "txtFilterValue_Change" routine into the VBA CodeModule for the "ClientStats" worksheet? It won't work if it is incorporated into a standard VBA CodeModule.



    (Like if I had "ABC Car Wash" I couldn't search for "car" and have it show

    To get the filter to work the way you describe, just replace the highlighted line in the following code extract:

    Please Login or Register  to view this content.
    with this one:

    Please Login or Register  to view this content.

    NOTE FOR EXPERTS:

    If you want to see one of Excel's "quirks", just omit the "VBA." qualifier from the above statement - it seems that special tactics must be adopted when using the Instr function with named arguments.



    Hope this helps - as before, please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  25. #25
    Registered User
    Join Date
    10-01-2021
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    42

    Re: Shortcut for the "search" option in filters

    I found what I did wrong! It's working now . . . the only thing is it takes a long time because there are so many rows.

    Thanks for the code change!
    Last edited by cpFAL96; 03-17-2022 at 06:24 PM.

  26. #26
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Shortcut for the "search" option in filters

    Hi again,

    Many thanks for your feedback.

    You're welcome - glad I was able to help.

    Regards,

    Greg M

+ 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. Adding a "Take Me There" option to a Multiple Search criteria Macro ?
    By hans302 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-07-2017, 10:42 AM
  2. 7 nested IF statements with a SEARCH added IF(ISNUMBER(SEARCH({"INSUR","AP REFUND"}
    By michaelproctor001 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 12-10-2013, 02:13 PM
  3. Replies: 8
    Last Post: 10-17-2012, 02:39 PM
  4. Help Needed to get Filters Using "Include" and "Exclude" multiple values on one column.
    By alfykunable in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2012, 04:03 AM
  5. [SOLVED] Invoice "Current" or "Overdue" (but need "Paid" option)
    By rwatson in forum Excel General
    Replies: 5
    Last Post: 04-05-2012, 12:16 PM
  6. [SOLVED] "Search for files and folders" option doesnot work for 100%
    By ECouwenberg in forum Excel General
    Replies: 7
    Last Post: 01-11-2006, 12:55 PM
  7. Stop users from accessing "Protection" option from "Tools" menu
    By I Believe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2005, 10:50 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