Change a Pivot Table Report Filter Using a Data Validation List

louisgeorgiou

New Member
Joined
Apr 13, 2010
Messages
3
I have a spreadsheet that has multiple work sheets which each have a pivot table with Year and Month Report Filters.
I'd like to be able to select the Year and Month via Data Validation Lists on the front sheet (my dashboard) and automatically have the Pivot Tables update in the other work sheets.
How would this be possible? Via VBA only?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi, Louis

You could use VBA. Please refer http://www.contextures.com/excelfiles.html#Pivot

Fully automatic without VBA will be limiting, such as set up the pivot table to query external data and refresh every n minutes.

Or, you could have minimal VBA (just one line?) to refresh of pivot tables on change to either of the data validation cells. For this, set up the pivot tables by joining the current source data with the data validation cells. SQL like below. VBA would be something like this pseudo code

sub worksheet_change(target as range)
if to identify target is year or month data validated cell then wbk.refreshall
end sub

HTH, Fazza

Code:
SELECT s.fields
FROM source s, validation_cells v
WHERE s.year = v.year AND s.month = v.month
 
Upvote 0
I am trying to run this code, but it's not working....even on the sample excel file that is provided in post# 3. Any idea why the code is not running? Thanks
 
Upvote 0
Hi,

Look like the kind of codes I am looking for but sadly when I open the excel file from which the link is in this discussion, it doesn't work. I tried to implement it on my huge file and it doesn't either.. any idea why??
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top