+ Reply to Thread
Results 1 to 6 of 6

VBA Autofitler multiple cell/ fields partial str match, treat blank fields as any results

  1. #1
    Registered User
    Join Date
    08-12-2014
    Location
    CA
    MS-Off Ver
    2011
    Posts
    73

    VBA Autofitler multiple cell/ fields partial str match, treat blank fields as any results

    Hi All,
    I have some code below. Right now a message box comes up and I type in a search term *3RD* for example.

    Firstly, how can I get rid of typing *term* the asterisks...
    Secondly instead of a message box I just want to use cells that I type into. But if the cell is blank, I want it to be treated so that it returns any result. For example if a record is field1=12 field1=6c and I enter into cell1:1 and nothing in cell2, that match should return. I have attached a file.
    WildCardFilter.xlsb
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: VBA Autofitler multiple cell/ fields partial str match, treat blank fields as any resu

    Ha! that's a worksheet and code I made several years ago.
    The copy code comes from Tom Ogilvy, that I got from Contextures web page.

    Anyway,
    You can use wildcards for filtering like this.
    Please Login or Register  to view this content.
    What cells did you want to use as the criteria to filter for?
    It looks like you have about 12 criteria cells but you don't have that many columns.

    I will just use two criteria so you will get an idea.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by davesexcel; 11-15-2014 at 06:11 PM.

  3. #3
    Registered User
    Join Date
    08-12-2014
    Location
    CA
    MS-Off Ver
    2011
    Posts
    73

    Re: VBA Autofitler multiple cell/ fields partial str match, treat blank fields as any resu

    Hi Dave,
    I have written code that uses the same wild card, however, I am having trouble getting a return from two types of data, firstly numbers and secondly dates. I search for *6* in a list of 0.651 6.02 106.2 and the return is 0 results. What is causing this and how can I fix it. Second *11/9* from 11/9/2013 or *2014* from 11/9/2014 returns no results. For example I want to search column 1 for Criteria A=392 I get no results, i did change this...

    Please Login or Register  to view this content.
    Any ideas?
    Last edited by sdl2; 11-19-2014 at 08:26 PM.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: VBA Autofitler multiple cell/ fields partial str match, treat blank fields as any resu

    are we both talking about the same workbook?

  5. #5
    Registered User
    Join Date
    08-12-2014
    Location
    CA
    MS-Off Ver
    2011
    Posts
    73

    Re: VBA Autofitler multiple cell/ fields partial str match, treat blank fields as any resu

    Hi Dave,
    Yes it is the same workbook, my workbook has much more data. But if you search field 1 for 6 or the date field ex. 2014, no results are returned. I think this is because the data type is numerical and date. How can I convert the column to text and search it and then back to numerical and date? Is this the appropriate way to handle these data types?

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: VBA Autofitler multiple cell/ fields partial str match, treat blank fields as any resu

    maybe post the problem workbook

+ 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. Combining Partial Name Fields
    By OlneyFD in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-04-2014, 11:17 PM
  2. Replies: 11
    Last Post: 11-03-2013, 09:16 PM
  3. Replies: 4
    Last Post: 10-07-2011, 10:36 AM
  4. Replies: 1
    Last Post: 03-07-2011, 01:33 AM
  5. match multiple fields in records
    By prawer in forum Excel General
    Replies: 3
    Last Post: 08-06-2009, 01:54 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