Advanced pivot table filtering VBA

deadlyliquidx

New Member
Joined
Feb 6, 2015
Messages
27
Good Morning All!
So I have a pivot table connected to a database.
Now I have three pivot tables, one for Year to date, month to date, and week to date.
Now its a huge database so it takes a good half an hour for each pivot to update.
Problem is that the person has to come back to the sheet to do MTD filter and then again after the long wait to the WTD Filter.
Is there anyway to set it so that the person can choose the dropdown filters for all three pivot tables first and then click a button (macro) so that it refreshes each filter based on the chosen dropdowns one after the other automatically.
Then someone can literally choose the filters and go grab a cup of coffee or something instead of waiting on one to finish after another.

This would be super helpful.
Thanks!!!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Depending on what version of Excel your working on you may want to look into using PowerPivot or refining the data that is being pulled by creating a database query. This would do some of the work for you.

This is how to set Pivot Table filters in VBA:
Code:
   [COLOR=#008000]'Put a dropdown in A1[/COLOR]
   MyFilter = Range("A1").Value
   ActiveSheet.PivotTables("PivotTable1").PivotFields("Month").CurrentPage = MyFilter
 
Upvote 0
Depending on what version of Excel your working on you may want to look into using PowerPivot or refining the data that is being pulled by creating a database query. This would do some of the work for you.

This is how to set Pivot Table filters in VBA:
Code:
   [COLOR=#008000]'Put a dropdown in A1[/COLOR]
   MyFilter = Range("A1").Value
   ActiveSheet.PivotTables("PivotTable1").PivotFields("Month").CurrentPage = MyFilter

That didnt do it, I just literally need to tell my pivot table to not update when I choose a new dropdown filter. I can figure out the rest of the code from there.
Like something on the private sub worksheet Code to tell the sheet not to allow any pivot updates until told to do so.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,844
Members
449,051
Latest member
excelquestion515

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