Working on UDF to display the filter criteria for a table. UDF would be just above filtered table. Found perfect UDF but only works on normal filters, not table filters. Having trouble adapting it:
Function Show_Criteria(Rng As Range) As String
Dim str1 As String, str2 As String
Dim tbl As ListObject
Application.Volatile
Set tbl = ActiveSheet.ListObjects("mytable")
With tbl.Range.AutoFilter Field:= tbl.Rng.Column
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
Show_Criteria = UCase(Rng) & ": " & str1 & str2
End Function
Function Show_Criteria(Rng As Range) As String
Dim str1 As String, str2 As String
Dim tbl As ListObject
Application.Volatile
Set tbl = ActiveSheet.ListObjects("mytable")
With tbl.Range.AutoFilter Field:= tbl.Rng.Column
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
Show_Criteria = UCase(Rng) & ": " & str1 & str2
End Function