HiddenItemsList in OLAP Pivot Table Filter giving error

LuluBelle

New Member
Joined
Mar 17, 2015
Messages
6
Hi
I'm trying to get HiddenItemsList to work in my OLAP pivot table

I have a list of a few thousand products. First I needed to select the top 500 of these (I got the code to work for this).
Now I need to select everything except the top 500 - this is where things have got tricky.

My code to choose the top 500 - this works fine :)

Dim myArray() As Variant
Dim myR As Range

Set myR = Range("Prod_Range")

ReDim myArray(0 To myR.Cells.Count - 1)

'Populate array
For i = 0 To myR.Cells.Count - 1
myArray(i) = "[Product].[Product Code Description].[" & myR.Cells(i + 1).Value & "]"
Next i

ActiveSheet.PivotTables("PivotTable1").PivotFields("[Product].[Product Code Description]. _
[Product Code Description]").VisibleItemsList = myArray

But when I try to do the same thing but with HiddenItemsList I get run-time error 1004: Application-defined or object-defined error
Same code as above but with the line below swapped out for the last line (VisibleItemsLIst line)

ActiveSheet.PivotTables("PivotTable2").PivotFields("[Product].[Product Code Description]. _
[Product Code Description]").HiddenItemsList = myArray

I read somewhere I need to set IncludeNewItemsInFilter - I added this line just above the HiddenItemsList line but I just got another error. First time I've used this field so my syntax might not be right, or this might not be the right solution...
ActiveSheet.PivotTables("PivotTable2").PivotFields("[Product].[Product Code Description]. _
[Product Code Description]").IncludeNewItemsInFilter = True

Any suggestions on getting HIddenItemsList to work?

Thanks
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,214,573
Messages
6,120,310
Members
448,955
Latest member
Dreamz high

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