Clear filter from table

I am trying to run a macro that replaces data in a table in Excel, when the data can be initially filtered.

The code must first remove the filter and then run the rest of the code.

I tried the "Autofilter" command, but then the usual filter option in the table range was not visible, and I had to manually create the filter parameter again (for me this is not very important, but other people use this file).

Is there a way to clear a filter WITHOUT removing filters from a table?

+8
source share
3 answers

For a table, you can simply use the ShowAllDataobject method Autofilter:

activesheet.listobjects(1).autofilter.showalldata

, , .

+16

, "... ClearAllData" .

Sneaky - - ( , ), , (, 2 ) - :

ActiveSheet.ListObjects(1).Range.AutoFilter Field:=2, Criteria1:="=*"
0
ActiveSheet.ShowAllData

or

Cells.AutoFilter
-1
source

Source: https://habr.com/ru/post/1612126/


All Articles