+ Reply to Thread
Results 1 to 6 of 6

Filter data based on input box entry

  1. #1
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Filter data based on input box entry

    Hello -

    Attached is a an example workbook containing attribute values in column B. I've already created a command button object that displays an input box in which the user can enter all, or any portion of, an attribute name he or she wants to search out. What I need is code that will take what the user enters in the input box and find every instance in the list of attributes in which that text appears. Next, I want to hide any rows containing attributes that don't meet the input criteria.

    Example:

    If user were to enter the word "Case" in the input box, the result would be that only rows 14 and 16 would appear as filtered results.

    Thanks for any assistance.

    Grillman
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Filter data based on input box entry

    Try it like this:

    Test1.xlsm
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Re: Filter data based on input box entry

    Works perfectly! Thank you

  4. #4
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Re: Filter data based on input box entry

    Bernie -

    I tried changing without success:

    From

    Range("A14").CurrentRegion.AutoFilter Field:=1, Criteria1:="*" & Me.TextBox1.Text & "*"

    to

    Intersect(Range("14:100000",Range("A14").CurrentRegion).AutoFilter Field:=1, Criteria1:="*" & Me.TextBox1.Text & "*"

    to keep the selection from including row 13.


    My actual workbook is attached.

    Thanks -

    Grilleman
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Re: Filter data based on input box entry

    Oooops - here is my workbook again... unprotected.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Filter data based on input box entry

    The code did not work because you have a column A of data, so the filter field index needs to be 2 for that range, not 1.

    Here is the fixed workbook - I un-hid all the rows.

    Test2.xlsm

+ 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. Run Macro based on input box entry
    By jrockusa50 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-04-2012, 02:16 PM
  2. Replies: 3
    Last Post: 02-24-2011, 01:48 AM
  3. Filter Data based on User Input
    By izet99 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-17-2009, 05:51 PM
  4. Filter Pivot based on macro entry....
    By MSherfey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2009, 02:54 PM
  5. Row filtering based on input box entry (column heading)
    By Santed593 in forum Excel Formulas & Functions
    Replies: 40
    Last Post: 09-06-2005, 07:05 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