从表中清除过滤器 [英] Clear filter from Table
问题描述
代码应该首先删除过滤器。 ,然后运行其余的代码。
我尝试过自动过滤器命令,但是表的范围上的普通过滤器选项不可见,再次手动创建过滤器选项(对我而言并不重要,但其他人使用此文件)。
有没有办法清除过滤器,而不需要删除过滤器表格?
对于表格,您只需使用 ShowAllData
Autofilter
对象:
activesheet.listobjects(1) .autofilter.showalldata
注意,即使没有当前应用的过滤器,也不会出错。 p>
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?
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.
这篇关于从表中清除过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!