Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear filter from Table

Tags:

I'm trying to run a macro that replaces data in a table in Excel, when the data might initially be filtered.

The code should remove the filter first, then run the rest of the code.

I tried the "Autofilter" command, but then the normal filter option on the table's range weren't visible, and I had to manually create the filter option again (not a big deal to me, but other people use this file).

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

like image 477
Dunn Avatar asked Oct 18 '15 11:10

Dunn


1 Answers

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.

like image 183
Rory Avatar answered Sep 28 '22 05:09

Rory