Public Sub Test()
If ShowFilter(Columns(1)) = "=1" Then
MsgBox "criteria is 1"
Else
MsgBox " not set to 1"
End If
End Sub
Public Function ShowFilter(rng As Range)
Dim oFilter As Filter
Dim sCriteria1 As String
Dim sCriteria2 As String
Dim sOperator As String
Dim nOp As Long
Dim nOff As Long
Dim rngFilter As Range
Dim sh As Worksheet
Set sh = rng.Parent
If sh.FilterMode = False Then
ShowFilter = "No Active Filter"
Exit Function
End If
Set rngFilter = sh.AutoFilter.Range
If Intersect(rng.EntireColumn, rngFilter) Is Nothing Then
ShowFilter = CVErr(xlErrRef)
Else
nOff = rng.Column - rngFilter.Columns(1).Column + 1
If Not sh.AutoFilter.Filters(nOff).On Then
ShowFilter = "No Conditions"
Else
Set oFilter = sh.AutoFilter.Filters(nOff)
On Error Resume Next
sCriteria1 = oFilter.Criteria1
sCriteria2 = oFilter.Criteria2
nOp = oFilter.Operator
sOperator = ""
If nOp = xlAnd Then
sOperator = " And "
ElseIf nOp = xlOr Then
sOperator = " Or "
End If
ShowFilter = sCriteria1 & sOperator & sCriteria2
End If
End If
End Function