Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50194

Filter Pivot table based on max date in column

$
0
0
I am working on a "dashboard" for mangement and want to automate this as much as possible. I have a pile of pivot tables that I need to refresh and filter for the latest date. the source data is on tab "2012 YTD Charges", column A is month (in month/day/year format, 1/1/2012). Each month, a macro will kick off the data import from SQL, and refresh each pivot table. Problem is, how can I set the pivot table report filter to the maximum month value (there are some 7-8k lines of data for each month, all the August data has a date of 8/1/2012 for example). Using macro recording, I found where I can set the .CurrentPage and hard set the value, but I would like to make this dynamic. I can write a formula in Excel to find the max date and put in a hidden sheet, just not sure on the VB side how to get the value into the macro.

Any assistance is greatly appreciated!

Viewing all articles
Browse latest Browse all 50194

Trending Articles