+ Reply to Thread
Results 1 to 4 of 4

Forcing Advanced filter to cancel criteria if found no matches.

  1. #1
    Registered User
    Join Date
    11-25-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Forcing Advanced filter to cancel criteria if found no matches.

    I have a advanced filter that works pretty much close to how I want it to. However I would like it to either cancel the new filter or copy everything if it finds 0 matches.

    If the copied location is blank it breaks my sheet. So I need to find a way for it to never be blank, either by canceling it, copying everything, or finding some other way I haven't thought of.

    Also for some reason my Advanced Filter does NOT Ignore blank "OR" cells. If I place a word in the top cell, then leave the bottom blank, it searches for the top cell or anything and I end up with everything. Its quite frustrating.

    Please Login or Register  to view this content.
    Last edited by Trelander; 11-25-2009 at 04:25 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Forcing Advanced filter to cancel criteria if found no matches.

    Hello Trelander,

    You can check if the range is empty using this line of code...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    11-25-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Forcing Advanced filter to cancel criteria if found no matches.

    I am sure im completely making a mess of this, but I have only been working with VBA for little over 2 weeks or so, and my knowledge is limited.

    I attempted to input your code in there then check if its 0, if 0 then clear the criteria and reapply the filter, which would reset it back to a full list, but it gives me a "Compile Error: Method or data member not found". Any Suggestions?

    Heres my current code.

    Please Login or Register  to view this content.
    Ps. I appreciate the help, been fighting with this for days and it gets frustrating.

  4. #4
    Registered User
    Join Date
    11-25-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Forcing Advanced filter to cancel criteria if found no matches.

    I got it to work with this code now.

    Thanks for the help in pointing me in the right direction. I am still curious as to why my Advanced Filter wont ignore the blank cells in the OR line automatically, I keep having to try and find a way to make each cell = a blank space just to let it calc which of course makes trouble for other cells etc.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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