Hi,
Looking to see who could modify this code so that it works with 1) Excel Tables & 2) More than 2 criteria. Ultimately, I want to display to the user what the filtered content is showing.
Looking to see who could modify this code so that it works with 1) Excel Tables & 2) More than 2 criteria. Ultimately, I want to display to the user what the filtered content is showing.
Code:
Function AutoFilter_Criteria(rng As Range) As String'This will allow you to see Auto Filter Criteria
Dim str1 As String, str2 As String
Application.Volatile
With rng.Parent.AutoFilter
With .Filters(rng.Column - .Range.Column + 1)
If Not .On Then Exit Function
str1 = .Criteria1
If .Operator = xlAnd Then
str2 = " AND " & .Criteria2
ElseIf .Operator = xlOr Then
str2 = " OR " & .Criteria2
End If
End With
End With
AutoFilter_Criteria = UCase(rng) & ": " & str1 & str2
End Function
Last edited: