Here's a non-array formulas play which utilizes
Tom Ogilvy's UDF** to extract the filter criteria into a cell
A sample construct is available at:
http://www.savefile.com/files/6660963
FilterKeyCol in Master n replicate Filter to 5 sheets.xls
Assume the "master" sheet is: X,
data in cols A to C, from row2 down
(headers in row1)
Let's assume the key sync is to be
with the autofilter selection in col A
In sheet: X,
Put in E1:
=IF(showfilter(A:A)="No Active
Filter","",SUBSTITUTE(showfilter(A:A),"=","")+0)
Put in D2:
=IF($E$1="",ROW(),IF(A2=$E$1,ROW(),""))
Copy D2 down to the last row of data
(Leave D1 empty)
Then in the 5 "slave" sheets: 1,2,3,4,5
With the same headers in A1:C1
Put in A2:
=IF(ISERROR(SMALL(X!$D:$D,ROW(A1))),"",
INDEX(X!A:A,SMALL(X!$D:$D,ROW(A1))))
Copy A2 to C2, then fill down
to the same extent of data as in X
The 5 slave sheets will "sync"
to display with the filter selection in col A in X
**To implement the UDF:
Press Alt+F11 to go to VBE
Click Insert > Module
Copy and paste the UDF (below) into the white space on the right [everything
within the dotted lines ("begin vba" to "end vba")]
Press Alt+Q to get back to Excel
Then in Excel, we can use Tom's UDF as, eg in F1: =showfilter(A:A)
'-- begin vba --
Public Function ShowFilter(rng As Range)
Dim filt As Filter
Dim sCrit1 As String
Dim sCrit2 As String
Dim sop As String
Dim lngOp As Long
Dim lngOff As Long
Dim frng As Range
Dim sh As Worksheet
Set sh = rng.Parent
If sh.FilterMode = False Then
ShowFilter = "No Active Filter"
Exit Function
End If
Set frng = sh.AutoFilter.Range
If Intersect(rng.EntireColumn, frng) Is Nothing Then
ShowFilter = CVErr(xlErrRef)
Else
lngOff = rng.Column - frng.Columns(1).Column + 1
If Not sh.AutoFilter.Filters(lngOff).On Then
ShowFilter = "No Conditions"
Else
Set filt = sh.AutoFilter.Filters(lngOff)
On Error Resume Next
sCrit1 = filt.Criteria1
sCrit2 = filt.Criteria2
lngOp = filt.Operator
If lngOp = xlAnd Then
sop = " And "
ElseIf lngOp = xlOr Then
sop = " or "
Else
sop = ""
End If
ShowFilter = sCrit1 & sop & sCrit2
End If
End If
End Function
'-- end vba --
Sharon said:
Hi,
I have a workbook with 5 worksheets.
The first three columns of each sheet are identical and linked to the
appropriate cells in the first worksheet.
Is there a way that one can set a filter so that when the first worksheet is
filtered, that the other worksheets are also automatically and simultaneously
filtered??
There is not evaluating of cells, i.e. no sum required, and I have not been
able to find a way.
Please Help!!!!!