隐藏数据透视表上字段的所有值(除了一个值)

发布于 2025-01-15 02:01:02 字数 277 浏览 1 评论 0原文

我正在努力解决一些应该很简单的事情,而且似乎无法通过谷歌来解决它。

我有一个名为“HL”的工作表,其中有一个名为 PivotTable1 的数据透视表 每次我刷新表格时,它都会在名为“角色”的字段中引入各种值。

我只想最终只有一个角色显示哪个=“PO”,

我试图找到一种方法来查看所有值,然后关闭然后重新打开该值(听起来效率低下,但以我有限的知识)我希望我能到达那里,但我正在挣扎)。

我确实有一些示例代码,但它们来自其他人,不适用于此应用程序

感谢收到所有建议。 谢谢

I'm struggling with something that should be simple and can't seem to google my way out of it.

I have a Sheet called "HL", with a Pivot table called PivotTable1
Each time I refresh the table it could bring in various values in field called "Role".

I want to end up with only one role showing which = "PO",

I've tried to find a way to look through all the values to turn then off and then turn that one back on (sounds inefficient, but with my limited knowledge I hoped I get there, but I'm struggling).

I do have some example code, but they are from others and don't work for this application

All suggestions gratefully received.
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

违心° 2025-01-22 02:01:02

感谢您的回复。

我刚刚找到了一种可行的方法,

仅在数据透视表中显示您想要定义的特定值,这样就可以了。

            Dim PivotField As PivotField
            Dim filterValue As String
        
                 With ActiveSheet.PivotTables("PivotTable2").PivotFields("ROle")
                      Set PivotField = ActiveSheet.PivotTables("PivotTable2").PivotFields("Role")
                      filterValue = "PO"               
                      PivotField.CurrentPage = filterValue 
                End With

thanks for replying.

I've just worked out a way to do it that works,

To only show specific values in a Pivot, that you want to define, this will do it.

            Dim PivotField As PivotField
            Dim filterValue As String
        
                 With ActiveSheet.PivotTables("PivotTable2").PivotFields("ROle")
                      Set PivotField = ActiveSheet.PivotTables("PivotTable2").PivotFields("Role")
                      filterValue = "PO"               
                      PivotField.CurrentPage = filterValue 
                End With
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文