+ Reply to Thread
Results 1 to 3 of 3

change multiple pivot tables on 1 sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-22-2006
    MS-Off Ver
    2010
    Posts
    201

    change multiple pivot tables on 1 sheet

    Hi all,

    I have a sheet called "Report" which contains 3 separate pivot table all with the common field "Division". I would like the other 2 pivots to change to the Division I select from the field called "Division" on the first pivot table without having to select them manually.

    Any help gratefully received.
    thanks
    x

  2. #2
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848
    Right click on your Report tab and choose View Code. Paste the following.
    
    Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
    If Not Target = ActiveSheet.PivotTables("PivotTable1") Then
    Exit Sub
    Else
    'MatchPivots
    Dim i As Integer, itemCount As Integer
        itemCount = ActiveSheet.PivotTables("PivotTable1").PivotFields(1).PivotItems.Count
    
        For i = 1 To itemCount
            ActiveSheet.PivotTables("PivotTable2").PivotFields("division").PivotItems(i).Visible = _
            ActiveSheet.PivotTables("PivotTable1").PivotFields("division").PivotItems(i).Visible
            ActiveSheet.PivotTables("PivotTable3").PivotFields("division").PivotItems(i).Visible = _
            ActiveSheet.PivotTables("PivotTable1").PivotFields("division").PivotItems(i).Visible
            
    
        Next
    End If
    End Sub

  3. #3
    Forum Contributor
    Join Date
    11-22-2006
    MS-Off Ver
    2010
    Posts
    201
    thank you MDBCT, much appreciated !
    Lucy.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1