Change page field in multiple pivot tables on one sheet

  • I have 3 or more pivot tables on one sheet and would like the page field of all to change with the first one. There is a couple sources of code around these groups (Dave Hawley, 4/29/01), but I cannot seem to get them to work. Does anyone have any suggestions?

  • Interesting question ...


    I will do it this way, instead of changing it in page, I change the value in a cell, say E1


    and then change all the page values.... by this code....

    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Union(Target, Range("E1")).Address = Range("E1").Address Then
    For Each pvt In ActiveSheet.PivotTables
            pvt.PivotFields("City").CurrentPage = Range("E1").Value
    Next
    End If
    End Sub


    It is working for me... .let me know if it does not.... I will attach a file.


    HTH

    Thanks: ~Yogendra

  • Re: Change page field in multiple pivot tables on one sheet


    Thanks for the code sample, HTH

    What if you need to change multiple values (i.e. selecting multiple items within the page field to be hidden or not)? My table is not based on an OLAP cube and it seems like there are all kinds of limitations if it is not.

    I would also be open to simply changing the page field to a row field temporarily, making the selections and returning it to a page field. But I can't find examples of how to do that either.

    Thoughts?

  • Re: Change page field in multiple pivot tables on one sheet


    If I understand correctly:


    Select an item in any pivot table's page fields, and page fields for pivot tables on the other worksheets will change to the same Item.
    Matching page fields are also set to the same setting for "Select Multiple Items"


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!