ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PivotTable columns not going Invisible (https://www.excelbanter.com/excel-programming/281641-pivottable-columns-not-going-invisible.html)

Stoney

PivotTable columns not going Invisible
 
I have a pivot table in Excel 2000 based on an OLAP cube.
There is one field on the column of the PT
called "StoreName". There are 20 StoreNames on the cube
but I want only 5 to appear on the PT.

When I build this PT, all 20 come over from the cube. I
was anticipating that the visible property of the
PivotItem object might allow me to see only the StoreNames
I want by setting the others invisible with something like
this:

'pt is the pivot table
Dim pf as PivotField
Dim pi as PivotItem
For Each pf In pt.VisibleFields
If pf.Orientation = xlColumnField Then
For Each pi In pf.PivotItems
If Left(pi.name,1) = "N" Then
pi.Visible = False
End If
Next
End If
Next

I get "Run-time error 1004. Application-defined or object-
defined error" as this line: pi.Visible = False.

This works if the PT source is something besides a cube.
I'm hoping you might know how to do this for a cube.

Thanks,
Stoney


All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com