ryssa
copy and paste all of the code starting with Option Explicit AND paste
into your module sheet
Filter one sheet however you want then Press Alt + f8
select MacroFilter1
this will run the macro setting the filters on the other sheets to th
same as on the active sheet
Test using different filter combinations
If ok then we can look at other methods of activating the macro
Option Explicit
Dim sCriteria() As String
Sub MacroFilter1()
Dim wS As Worksheet
Dim wsAct As Worksheet
Dim iCol As Integer
Set wsAct = ActiveSheet
For Each wS In Worksheets
Debug.Print wS.Name
If wsAct.Name <> wS.Name Then
For iCol = 1 To _
Cells(1, Columns.Count).End(xlToLeft).Column _
Step 1
Call FilterCriteria(wsAct.Cells(1, iCol))
Select Case sCriteria(0)
Case ""
wS.Rows(1).AutoFilter Field:=1
Case 0
wS.Rows(1).AutoFilter Field:=iCol, _
Criteria1:=sCriteria(1)
Case Else
wS.Rows(1).AutoFilter Field:=iCol, _
Criteria1:=sCriteria(1), _
Operator:=sCriteria(0), _
Criteria2:=sCriteria(2)
End Select
Next iCol
End If
Next wS
End Sub
Sub FilterCriteria(oRng As Range)
'Dim sFilter As String
ReDim sCriteria(2)
On Error GoTo NoMoreCriteria
With oRng.Parent.AutoFilter
'Is it in the AutoFilter range?
If Intersect(oRng, .Range) Is Nothing Then _
GoTo NoMoreCriteria
'Get the filter object for the appropriate column
With .Filters(oRng.Column - .Range.Column + 1)
'Does this column have an AutoFilter criteria?
If Not .On Then GoTo NoMoreCriteria
'It has one!
sCriteria(1) = .Criteria1
'Does it have another (i.e. the "Custom" filter)?
sCriteria(0) = .Operator
sCriteria(2) = .Criteria2
End With
End With
NoMoreCriteria:
End Su