Results 1 to 3 of 3

Multiple Criteria for Autofilter using And & Or

Threaded View

  1. #1
    Registered User
    Join Date
    06-13-2011
    Location
    Neston, England
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    38

    Multiple Criteria for Autofilter using And & Or

    Hi I am getting a compilation error stating 'Application-defined or Object-defined error' on the following statement

              ActiveSheet.Range(Filter_Range).AutoFilter Field:=C_DUEDATE, Criteria1:="=N/A", Operator:=xlOr, Criteria2:=">=" & ds, Operator:=xlAnd, Criteria3:="<=" & de
    Filter_Range is variable for the range and is set OK (there are multiple other filters applied before and after which work fine)
    C_DUEDATE is a constant for the Column Number
    ds is date start as a date serial, de is date end as date serial

    My feeling is the error is something to do with mixing And and Or in same filter? is there any way of 'adding brackets' it should be value = N/A or (>=ds and <=de) but not sure exactly how to do this?

    Alternatively is there a filter add. So I could filter out the date range and then add any that are N/A

    Help as always much appreciated.
    Last edited by Wongadob; 07-18-2011 at 01:40 PM. Reason: To Flag as solved - Need to find another solution

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