Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8322833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:31:03+00:00 2026-06-08T23:31:03+00:00

So I have multiple pivot tables on a single sheet in excel. I have

  • 0

So I have multiple pivot tables on a single sheet in excel. I have a long list of months in the row labels. The report filter is filterable by names. All of the columns in the pivots are just sums of data.

What I’m looking for (and I’m guessing a macro is the only way to do it), is a way to be able to change the filters of one of the pivots on that sheet and it update the other pivots on only that sheet to mimic the filters (both report and row label) of the one that I changed. Nothing else should change in the other pivot tables – just the filters.

Unfortunately, I literally know nothing about coding vba (I know a bit of java and stuff but I’ve never done any macro coding). I was able to copy a macro from the internet that did part of what I need; it updates the report filter but doesn’t update the dates in the row label filter. Here’s the coding for that:

Option Explicit
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
On Error Resume Next
Dim wsMain As Worksheet
Dim ws As Worksheet
Dim ptMain As PivotTable
Dim pt As PivotTable
Dim pfMain As PivotField
Dim pf As PivotField
Dim pi As PivotItem
Dim bMI As Boolean

On Error Resume Next
Set wsMain = ActiveSheet
Set ptMain = Target

Application.EnableEvents = False
Application.ScreenUpdating = False

'change all fields for all pivot tables on active sheet

For Each pfMain In ptMain.PageFields
    bMI = pfMain.EnableMultiplePageItems
        For Each pt In wsMain.PivotTables
            If pt <> ptMain Then
                pt.ManualUpdate = True
                Set pf = pt.PivotFields(pfMain.Name)
                        bMI = pfMain.EnableMultiplePageItems
                        With pf
                            .ClearAllFilters
                            Select Case bMI
                                Case False
                                    .CurrentPage = pfMain.CurrentPage.Value
                                Case True
                                    .CurrentPage = "(All)"
                                    For Each pi In pfMain.PivotItems
                                        .PivotItems(pi.Name).Visible = pi.Visible
                                    Next pi
                                    .EnableMultiplePageItems = bMI
                            End Select
                        End With
                        bMI = False

                Set pf = Nothing
                pt.ManualUpdate = False
            End If
        Next pt
Next pfMain

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub

Is there anyway to do what I’m looking to do? Your help would be GREATLY appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:31:04+00:00Added an answer on June 8, 2026 at 11:31 pm

    Without seeing your pivottables it seems that all you need to do to the above code is repeat the steps from setting the pivotfield value to reflect the date. This is done by
    adding a variant of the loop set up by the line:

        set pf = pt.pivotfields(pfmain.name)
    

    to

        set pf = pt.pivotfields(pfmain.nameofyourrowfiltervariable)
    

    the full code is below, i would also avoid on error resume next

        Option Explicit
        Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
        On Error Resume Next
        Dim wsMain As Worksheet
        Dim ws As Worksheet
        Dim ptMain As PivotTable
        Dim pt As PivotTable
        Dim pfMain As PivotField
        Dim pf As PivotField
        Dim pi As PivotItem
        Dim bMI As Boolean
    
        On Error Resume Next
        Set wsMain = ActiveSheet
        Set ptMain = Target
    
        Application.EnableEvents = False
        Application.ScreenUpdating = False
    
        'change all fields for all pivot tables on active sheet
    
        For Each pfMain In ptMain.PageFields
            bMI = pfMain.enablemultiplepageitems
            For Each pt In wsMain.PivotTables
              If pt <> ptMain Then
                pt.ManualUpdate = True
                Set pf = pt.PivotFields(pfMain.Name)
                        bMI = pfMain.EnableMultiplePageItems
                        With pf
                            .ClearAllFilters
                            Select Case bMI
                                Case False
                                    .CurrentPage = pfMain.CurrentPage.Value
                                Case True
                                    .CurrentPage = "(All)"
                                    For Each pi In pfMain.PivotItems
                                        .PivotItems(pi.Name).Visible = pi.Visible
                                    Next pi
                                    .EnableMultiplePageItems = bMI
                            End Select
                        End With
                        bMI = False
    
                   Set pf = pt.pivotfields(pfMain.nameofdatevariable)
                   dates = pfMain.enablemultiplepageitems
                   with pf
                       .clearallfilters
                       select case dates
                           case false
                                   .currentpage = pfmain.currentpage.value
                           case true
                                   .currentpage = "(All)"
                                   for each pi in pfmain.pivotitems
                                        .pivotitems(pi.nameofdatevariable).visible = pi.visible
                                    next pi
                                    .enablemultiplepageitems = dates
                           end select
                   end with
                   date = false
                   set pf = nothing
                   pt.ManualUpdate = False
               End If
           Next pt
       Next pfMain
    
      Application.EnableEvents = True
      Application.ScreenUpdating = True
    
      End Sub
    

    try it and see if it works I have not tested this

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one large Excel workbook with multiple worksheets containing pivot tables linked to
I have multiple websites run on single database. My question related table Structure is
In Excel 2007, I have a single dataset in the form of an Excel
I have multiple autocomplete inputs on my page. Behind the scenes, each autocomplete list
I have 3 tables, Client, Tool and ClientTools. One client can have multiple tools,
I have a multiple html tables on a page which each have a header
i have multiple files each containing 8/9 columns. for a single file : I
I may resort to using multiple pivot tables if I cannot do this but
I have multiple ajax requests with javascript code as response, and I need to
I have multiple projects which are to be hosted together in a Tomcat container,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.