• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Autofilter VBA

Sudarshan

New Member
Hi,

I am using this macro below.

Sub AutofilterMatchDay()

Range("A4").AutoFilter Field:=8, Criteria1:=Range("F1").Value
Range("A4").AutoFilter Field:=9, Criteria1:=Range("G1").Value


End Sub

I would like it to modify to work as below:

If the cell is blank in F1 or G1 it should filter only the second range i.e G1 or F1 respectively.

Is this possible.

Thanks
Sudi
 
Just a wild guess
Code:
Sub AutofilterMatchDay()

If Not Isempty(Range("F1")) Then

Range("A4").AutoFilter Field:=8, Criteria1:=Range("F1").Value

End If

If Not Isempty(Range("G1")) Then

Range("A4").AutoFilter Field:=9, Criteria1:=Range("G1").Value

End If

End Sub
 
Back
Top