broncosrul
New Member
- Joined
- May 3, 2012
- Messages
- 25
I am looking for a way to "upload" a list of selections for a filter on a pivot table. The pivot is connected to an OLAP cube, so there are tens of thousands of records and we often only need to look at a small selection. However, finding those in the pivot is difficult without adding them one by one. So, I was able to use this bit of VBA to run a macro to do the filtering.
As you can see, it is a really long line of code that is connected with line continuations. However, VBA limits continuations at 24 and we would often want more records than that. I realize I can make one ridiculously long line by eliminating the continuations, but besides being unreadable, it seems like there would be a better option. Is there some bit of code that would be more efficient that would work on a pivot table? Something like an IN statement seems like it would be the best option.
Thanks
Code:
[TABLE="width: 374"]
<tbody>[TR]
[TD]Sheets("Pivot").Select
[/TD]
[/TR]
[TR]
[TD]ActiveSheet.PivotTables("PivotTable1").PivotFields( _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID]").VisibleItemsList = Array( _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID].&[TFP_200090]", _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID].&[TFP_200091]", _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID].&[TFP_200092]", _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID].&[TFP_200093]", _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID].&[TFP_200094]", _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID].&[TFP_200095]", _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID].&[TFP_200096]", _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID].&[TFP_200333]", _
[/TD]
[/TR]
[TR]
[TD]"[Product].[ItemIDs].[ItemID].&[TFP_200337]")
[/TD]
[/TR]
</tbody>[/TABLE]
As you can see, it is a really long line of code that is connected with line continuations. However, VBA limits continuations at 24 and we would often want more records than that. I realize I can make one ridiculously long line by eliminating the continuations, but besides being unreadable, it seems like there would be a better option. Is there some bit of code that would be more efficient that would work on a pivot table? Something like an IN statement seems like it would be the best option.
Thanks