Se7enSquared
10/21/2019 - 10:21 PM

Filter: Save user's filter and auto-restore

Store the user's filter of the first column of a listobject and then reapply it

Public Function PlatformFilter() As String
' returns the value of any filter applied to the platform column
    If ActiveSheet.ListObjects("tblNotes").AutoFilter.Filters(1).On Then
        PlatformFilter = ActiveSheet.AutoFilter.Filters(1).Criteria1
    End If
End Function

Public Sub ApplyFilter()
    criteria = PlatformFilter
    'criteria = Replace(criteria, "=", "")
    If ActiveSheet.ListObjects("tblNotes").AutoFilter.Filters(1).On Then
        ActiveSheet.ShowAllData
        ActiveSheet.ListObjects("tblNotes").Range.AutoFilter Field:=1, Criteria1:=criteria
    End If
End Sub