PivotTable columns not going Invisible

S

Stoney

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top