+ Reply to Thread
Results 1 to 3 of 3

Include Blank Cells in Autofilter that uses an Array as Criteria

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-14-2007
    Location
    Chester, England
    MS-Off Ver
    2010 & 2016
    Posts
    312

    Include Blank Cells in Autofilter that uses an Array as Criteria

    Hello

    I hope someone can help. It feels like it should be really straighforward but its driving me mad.

    I have an autofilter that is working fine using an array but I want to include "(Blanks)" and this is where I am having trouble. I have tried listing it as Criteria2, I have tried adding it to the array, I have tried having a blank cell in the range I use to create the array but nothing seems to work.

    This is what I have so far.

    Dim DealArray As Variant
    
    DealArray = Sheets("Sheet1").Range("A2:A15").Value
    
    On Error Resume Next
    ActiveSheet.ShowAllData
    ActiveSheet.AutoFilterMode = False
    On Error GoTo 0
    
    DealArray = Application.Transpose(DealArray)
    
    ActiveSheet.Range("$A$1:$AZ$936").AutoFilter Field:=1, Criteria1:=DealArray, Operator:=xlFilterValues

    Does anyone know what I can add to or change about the above code to include blanks?

    Thanks in advance for any help

    Cheers

    Jim
    Last edited by JimmyA; 08-04-2017 at 10:00 AM.

  2. #2
    Forum Contributor
    Join Date
    02-14-2007
    Location
    Chester, England
    MS-Off Ver
    2010 & 2016
    Posts
    312

    Re: Include Blank Cells in Autofilter that uses an Array as Criteria

    Hi Again

    After a nearly a full day I have found a solution!!!!!

    It might be a fudge but I don't care.

    In the range I added a cell that contained '= (single quote and equals) and now it works.

    Just thought I would post what I did in case anyone else has this issue.

    Cheers

    Jim

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,994

    Re: Include Blank Cells in Autofilter that uses an Array as Criteria

    Thanks for letting us know. So many people don't bother even to say 'thank you' when they've received help, so this is very much appreciated.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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 3+ criteria using VBA or an array
    By kaemerso in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2017, 12:01 PM
  2. Countif Criteria incl non-blank cells within an array formula.
    By Miskondukt in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-31-2016, 05:24 PM
  3. [SOLVED] AutoFilter: Array as Criteria
    By Klaster in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-10-2014, 06:36 PM
  4. Replies: 1
    Last Post: 12-27-2013, 03:56 PM
  5. AutoFilter for multiple criteria and blank cells
    By crunchKH in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2013, 02:01 AM
  6. [SOLVED] Autofilter with multiple criteria - how to ignore blank criteria
    By MOONDRIFT47 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-31-2012, 12:20 PM
  7. [SOLVED] Need to Autofilter by date and include blank cells
    By Jigsaw314 in forum Excel General
    Replies: 2
    Last Post: 11-05-2012, 08:01 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