【发布时间】:2019-03-30 12:53:23
【问题描述】:
我的数据透视表包含一个过滤器,用于过滤带有"Days_Outstnading_Category"=">180 days" 的项目。
过滤后,我的行字段"Operating Units"只有2个项目显示在excel界面中,“美国”和“印度”,虽然“运营单位”中的所有项目都有Visible=True,但实际上只有2个项目可见在excel界面中。
我想知道如何识别这两个项目,因为 If pivotItem.Visible=True 现在无法使用。
最终我想迭代并选择出现在 excel 界面中的每个项目的 LabelRange(A5:A12、A14:A27、B5、B6:B9 等)并对每个范围进行一些格式更改。我下面的代码带来了一个找不到labelrange的错误。
> For Each ptRowField In pt.RowFields
> For Each ptRowFieldItem In ptRowField.PivotItems
> If ptRowFieldItem.Visible = True Then
> Call SetOusideBorder(ptRowFieldItem.LabelRange)
> End If
> Next ptRowFieldItem
> Next ptRowField
【问题讨论】:
标签: excel vba pivot-table