AutoFilter

  • Thread starter Thread starter 3@work
  • Start date Start date
Here is a UDF by Stephen Bullen that will do it

Function FilterCriteria(Rng As Range) As String
'By Stephen Bullen
'use like =FilterCriteria(A3)
' The single-cell argument for the FilterCriteria function
' can refer to any cell within the column of interest
'do not use the cell with the arrows, it will not update

Dim Filter As String
Filter = ""
On Error GoTo Finish
With Rng.Parent.AutoFilter
If Intersect(Rng, .Range) Is Nothing Then GoTo Finish
With .Filters(Rng.Column - .Range.Column + 1)
If Not .On Then GoTo Finish
Filter = .Criteria1
Select Case .Operator
Case xlAnd
Filter = Filter & " AND " & .Criteria2
Case xlOr
Filter = Filter & " OR " & .Criteria2
End Select
End With
End With
Finish:
FilterCriteria = Filter
End Function


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
Back
Top