Clear filter from Table
For a Table, you can simply use the ShowAllData
method of its Autofilter
object:
activesheet.listobjects(1).autofilter.showalldata
Note this won't error even if there is no filter currently applied.
This expands on the answer from @Rory (the go-to-answer I look up every time I can't remember the syntax). It avoids errors that occur when the table doesn't contain an auto-filter.
The section If Not .AutoFilter Is Nothing
checks for the AutoFilter object property of the ListObject (table). If it Is Nothing
then that table had it's auto-filter removed.
With Activesheet.Listobjects(1)
If not .AutoFilter Is Nothing Then .AutoFilter.ShowAllData
End With
Hi Guys use this "Worksheets("Sheet1").ListObjects(1).Range.AutoFilter = False" and please note if already filter applied it will remove filter on the other hand if filter not applied before it will apply the filter.