Filter OR HIDE PIVOT ITEMS IN CUBEFIELD

Hashiru

Active Member
Joined
May 29, 2011
Messages
286
Hi all,

I have this code for a normal PivotTable but external data source. I will like the second code snippet for cubefield to do the same as this first code snippet for normal PivotTable.

Code:
    'Filter the PageField
    With WS.PivotTables("xLabor")
         .PivotCache.MissingItemsLimit = xlMissingItemsNone
         '.PivotCache.Refresh
         With .PivotFields("System Source")
             .PivotItems(1).Visible = True
             For i = 2 To .PivotItems.Count
                 .PivotItems(i).Visible = False
             Next
         End With
         
        With .PivotFields("System Source")
                 .PivotItems("BAP").Visible = True
                 .PivotItems("BGL").Visible = True
                 .PivotItems("BTL").Visible = True
                 .PivotItems(1).Visible = False
        End With
    End With

I will like an equivalent code for a CubeField to replace this line of code:

Code:
    With ActiveSheet.PivotTables("NON-LABOR").CubeFields("[CSVFolderPivotTable].[FAIN]")
        .Orientation = xlRowField
        .Position = 1
    End With
    
    ActiveSheet.PivotTables("NON-LABOR").PivotFields("[CSVFolderPivotTable].[FAIN].[FAIN]").VisibleItemsList = Array("", "", "[CSVFolderPivotTable].[FAIN].&[DC-05-0011]", "", "", "", "", "", "", "", "", "", "", "", _
        "", "", "", "", "", "", "", "[CSVFolderPivotTable].[FAIN].&[DC-2017-005]", "", "", "", "", "", "", "[CSVFolderPivotTable].[FAIN].&[DC-2018-002]", "[CSVFolderPivotTable].[FAIN].&[DC-04-0007]", "[CSVFolderPivotTable].[FAIN].&[DC-04-0008]", _
        "[CSVFolderPivotTable].[FAIN].&[DC-2016-007]",  , "[CSVFolderPivotTable].[FAIN].&[DC-95-X015]")

I will like to loop and check for Items with DC-* but not DC-Planning.

Thanks in advance.

The items are about 100 for the above code, but I like to have
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top