如何在数据透视表过滤器中选择(全部) [英] How to select (All) in a pivot table filter

查看:191
本文介绍了如何在数据透视表过滤器中选择(全部)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的数据透视表中选择(全部)

I need (All) to be selected in my pivot table

我尝试了以下

Dim pf As PivotField
 Set pf = Worksheets("xxx").PivotTables("PivotTable1").PivotFields("myFilterField")
   For Each Pi In pf.PivotItems
          Pi.Visible = True
        Next Pi

这个工作非常缓慢,不太好

This works very slowly, and not well

另一个选项根本不起作用。它仅选择以前选择的一些项目

Another option does not work at all . It selects only some of the items that were selected previously

Worksheets("xxx").PivotTables("PivotTable1").PivotFields("myFilterField").CurrentPage = "(All)"


推荐答案

p>你可以打电话.Visible = True有几个原因,希望下面的一个涵盖你想要做的:

You could be calling .Visible = True for a couple of reasons so hopefully one of the below covers what you are trying to do:

如果你的意思是想要将所有的Pi设置为一步可见,而不是通过pf.PivotItems中的Pi进行枚举:

If you mean you want to set all the Pi to be visible in one step then rather than enumerating through the Pi in pf.PivotItems just:

pf.ShowAllItems = True

另一方面,如果您的意思是要清除所有过滤器,则:

If, on the other hand, you mean you want clear all filters then:

pf.ClearAllFilters()

或者,如果您只想清除手动过滤器(即不应用过滤器针对一个实际的行/列提交而不是一个过滤器字段)然后:

Or, if you want to just clear manual filters (i.e. not filters applied against an actual row/column filed but rather against a filter field) then:

pf.ClearManualFilters

请参阅PivotField对象成员的帮助完整列表

Consult help on PivotField Object Members for the full list

这篇关于如何在数据透视表过滤器中选择(全部)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆