Macro For Filtering on Multiple Sheets

R

Rick

Hi Jason,

Maybe this will get you started. I don't work with auto
filters a lot, but I found something that worked, with a
little experimentation. You can modify this to suit.
Also check the internet for more.

Note this works only with some conditions. It fails if
the criteria is (all) or (top10) etc. And it fails in
other cases too with other combinations. I think there's
a lot more work that has to be done with this....

Sub FourSheetAutoFilters()
Dim S1 As Worksheet: Dim S2 As Worksheet
Dim S3 As Worksheet: Dim S4 As Worksheet
Set S1 = Sheets(1): Set S2 = Sheets(2)
Set S3 = Sheets(3): Set S4 = Sheets(4)

If S1.AutoFilter.Filters(1).Criteria1 = "=Bill" Then
S2.Range("A1").AutoFilter Field:=1, Criteria1:="Bill"
S3.Range("A1").AutoFilter Field:=1, Criteria1:="Bill"
S4.Range("A1").AutoFilter Field:=1, Criteria1:="Bill"
Else
MsgBox "Not Bill"
End If
End Sub

If I find out more and better solutions, I'll let you
know. Meanwhile, let us know how you're doing with this.
Maybe you've figured it out and can share it with us. :)

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top