+ Reply to Thread
Results 1 to 6 of 6

VBA Autofilter -- Not filtering

  1. #1
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,924

    VBA Autofilter -- Not filtering

    Attached is a sample file. I am attempting to filter Column C employing VBA. I wish to filter so that only records beginning with 53 are visible. When I run this, it returns no records.

    Code employed:

    Please Login or Register  to view this content.
    Seem to be having a senior moment and cannot get the criteria correct.

    TIA

    Alan
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Autofilter -- Not filtering

    I think it has something to do with numbers versus text. I tried it on text (i.e., "aa*") and it worked just fine. It also worked if the values in column C were "53bge", "53fefe", etc. Couldn't get it to work on numbers.
    Last edited by stnkynts; 04-03-2014 at 04:31 PM.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA Autofilter -- Not filtering

    Alan,
    Filter (*) does not work with numbers.
    Please look at the attached.
    When I change the first two cells in to text, the code find them and filter them.
    stnkynts,
    While I was to reply your replied was deleted.
    Attached Files Attached Files
    Last edited by AB33; 04-03-2014 at 04:35 PM.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,924

    Re: VBA Autofilter -- Not filtering

    Thanks for help guys. I got some additional coding to do here now!

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA Autofilter -- Not filtering

    There is a short cut. Copy column 3 in to new column, delete (Or clear the data) column 3.
    Run this line on empty column 3

    Please Login or Register  to view this content.
    and copy the data from the new column in to column3.
    They are now formatted as text.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,924

    Re: VBA Autofilter -- Not filtering

    What I actually did was add a line of code as follows and that works for me.

    Please Login or Register  to view this content.
    I should have check back here 40 minutes ago and saved myself some lost time. Thanks again.

+ 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. AutoFilter: Setting Criteria1 to an Array for "Any of these words" type filtering
    By sheldonbeswift in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-16-2013, 10:57 AM
  2. AutoFilter is not filtering properly
    By Excel_vba in forum Excel General
    Replies: 1
    Last Post: 09-26-2012, 07:51 PM
  3. Filtering with Wildcards using Autofilter
    By Motox in forum Excel General
    Replies: 2
    Last Post: 03-16-2012, 06:40 AM
  4. Autofilter Not Filtering Properly
    By Paputxi in forum Excel General
    Replies: 1
    Last Post: 05-03-2006, 01:35 PM
  5. AutoFilter only filtering first 1000
    By Denise Robinson in forum Excel General
    Replies: 2
    Last Post: 03-21-2005, 06:06 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