If you have multiple pivot tables in a workbook, you can use programming to update all (or some) of the pivot tables, if one pivot table’s filters are changed.
I’ve written sample code that does this, and last year, Jeff Weir shared his version of the code, which runs very quickly.
Jeff’s code has another advantage too – in his version, you can specify:
- any sheets you DON'T want the macro to check
- any specific pivot tables that you DON'T want the macro to synchronize.
NOTE: Jeff's code is intended for pivots that DO NOT all share the same cache. If your pivots all share the same cache, then you can use my approach set out here: Filter Multiple Pivot Tables With Excel 2010 Slicers
To confirm whether or not your pivots share the same cache, you can use my code here: Excel Pivot Caches
Improved for Excel 2010 and Later
This week, Jeff is sharing his latest version of his code. It now checks the Excel version that you are using.
- If you are using Excel 2010 and later, the code uses Slicers to change any pivot tables that share the same cache, as this is much faster. Any other pivots are then processed without slicers.
Download the Sample File
To download this version of the sample file, with Jeff's code, please visit the Sample Files page on the Contextures website.
In the Pivot Tables section, look for: PT0029 - Change Pivot Table Fields on Specific Sheets
The file is in xlsm format, zipped, and contains macros. Enable the macros when opening the file, if you want to test the code.
Note: Jeff's sample file was updated on June 16, 2013, so please download the new version if you have an older copy of the file.