+ Reply to Thread
Results 1 to 2 of 2

VBA if multiple filter has no results

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-01-2015
    Location
    Chennai,India
    MS-Off Ver
    Microsoft Office 2021
    Posts
    146

    VBA if multiple filter has no results

    Hi all,

    Please assist me on the below requirement.

    > I need to Filter only blanks in Column B, Filter the date after March in Column C and i should exclude all the booked status.

    I have the following code wherein it works perfectly but my challenge is sometimes I may not have March month or the booked status during those scenario, only Column B filter has to work but i am getting an error with the below code.

    Please refer the attached file and the below code .

    Dim rng As Range
    
        Dim Rw As Long
        Dim sh As Worksheet
          Dim ws As Worksheet
        Dim lastRow As Long, i As Long
        
        Rw = Cells(Rows.Count, 1).End(xlUp).Row
        ActiveSheet.AutoFilterMode = False
        
        Set rng = Range("A1:CC1" & Rw)
        With rng
       
            .AutoFilter
            .AutoFilter Field:=2, Criteria1:="=", Operator:=xlAnd
            .AutoFilter Field:=3, Criteria1:= _
            ">3/31/2020", Operator:=xlAnd
               .AutoFilter Field:=4, Criteria1:="Booked", Operator:=xlAnd
         
            End With
    Attached Files Attached Files

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,275

    Re: VBA if multiple filter has no results

    What error on which line of code?

+ 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. [SOLVED] multiple results when using filter function
    By Morphyus C via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  2. [SOLVED] multiple results when using filter function
    By Morphyus C via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 PM
  3. multiple results when using filter function
    By Morphyus C via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 PM
  4. multiple results when using filter function
    By Morphyus C via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 11:05 AM
  5. [SOLVED] multiple results when using filter function
    By Debra Dalgleish in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-06-2005, 05:05 AM
  6. multiple results when using filter function
    By Morphyus C via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. [SOLVED] multiple results when using filter function
    By Morphyus C via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  8. [SOLVED] multiple results when using filter function
    By Morphyus C via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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