• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Selecting multiple items from a pivot's page field

DJ

Member
Hi All,

I am trying to select multiple items from a pivot table's page field.

Below code is not working. When I record macro to do this....it only sets property as "False" for the not selected items...nothing for selected items.

Code:
ActiveSheet.PivotTables("Pivot1").PivotFields("Items").EnableMultiplePageItems = True
  With ActiveSheet.PivotTables("Pivot1").PivotFields("Items")
      .PivotItems("Item1").Visible = True
      .PivotItems("Item5").Visible = True
      .PivotItems("Item8").Visible = True
      .PivotItems("Item11").Visible = True
      .PivotItems("Item14").Visible = True
      .PivotItems("Item20").Visible = True
      .PivotItems("Item25").Visible = True
      .PivotItems("Item26").Visible = True
      .PivotItems("Item28").Visible = True
      .PivotItems("Item29").Visible = True
  End With

Could you help me as how to select multiple items like I am trying to select?

Thanks,
DJ
-------------------------------------------------------------------------------------
Edited by Mod: Added Code tag.
 
Last edited by a moderator:
Hi, please use Code tag when posting code.
upload_2017-12-12_9-29-17.png

In order to show multiple items in regular (Excel Table/Range based) pivot table, you'll need to loop through each PivotItem to set it's property.

Have a look at thread linked below for sample filtering using PageField.
https://chandoo.org/forum/threads/report-filter-in-page-filed-in-pivot-table.33937/#post-201870

Upload sample workbook with your set up and criteria (logic) for selecting visible field for more targeted help.
 
Back
Top