简体   繁体   English

数据透视表使用Excel VBA展开和减去或显示/隐藏详细信息

[英]Pivot table expand and substract or Show/Hide Details using Excel VBA

I am trying to hide details of the pivot table column using the below command. 我试图使用以下命令隐藏数据透视表列的详细信息。 Can Some one let me know the mistake? 有人可以告诉我这个错误吗?

Thx. 谢谢。

     For Each c In Range("A1:A20000")
         With c
             If Left(.Value, 2) = "FA" Then ActiveSheet.PivotTables("PivotTable1").PivotFields("Ref 1").PivotItems( _
        "*").ShowDetail = False
             End With
     Next c

Finally found the silly mistake 终于找到了愚蠢的错误

Dim c As Range
     For Each c In myfile.Sheets(3).Range("A1:A20000")
         With c
            If Left(c.Value, 2) = "FA" Then ActiveSheet.PivotTables(1).PivotFields("Ref 1").PivotItems(c.Value).ShowDetail = False
        End With
     Next

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM