PDA

View Full Version : Hide Pivot items based on table



Justin6587
11-03-2017, 05:12 AM
I have a pivot table that contains a list of employees that are available to travel to assist in other locations. I would like to have (on another sheet) a table that I can keep updated with the employees currently traveling and will hide them from the pivot table and queries that reference it.
I have been able to get this working with set employee numbers


ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Associates].[Employee Number].[Employee Number]").HiddenItemsList = Array( _
"[Associates].[Employee Number].&[0]","[Associates].[Employee Number].&[34]")
Where "0" and "34" would be the employee numbers to exclude. But how would I make the array reference a table and exclude all entries from there? Any help would be greatly appreciated.

I have tried replacing the "0" with a reference to a (cell).Value but it didnt work. I am at a loss here.

SamT
11-04-2017, 07:38 AM
The # Icon in the Post editor is for VBA Code. It will insert Code Formatting Tags around selected text or you can insert the Tags and paste your code between them.


Consider this a Moderator bump.

p45cal
11-05-2017, 05:49 AM
Prepare us a little sample file with such a pivot, perhaps include what you've got working so far, so that we can test solutions out without spenidng time setting up your scenari while guessing (wrongly) the sorts and arrangement of data you have.