![]() |
parameter and macro driven pivot table filter?
***Originally posted rather sloppily to general questions, but this is more
appropriate here i think. I am trying to create a pivot table report based on start date and end date parameters set by the end user. It will produce a report for a given period of time, by month. Parameters will define the filter in attribute "End Month-Year" of the pivot table. I've gotten as far as list boxes that allow defining of 4 names for the the start and end dates: BegMo, BegYr, EndMo, EndYr and I have my data attribute "End Month-Year" (End in this latter case refers to the end dates of contracts or projects, which is what I am reporting on) in the pivot table. The following code allows me to select the two start and end dates defined in the pivot table filter, but it fails to do two things: a) Remove previously selected values in "End Month-Year" pivot table attribute and b) set "End Month-Year" to select all values between "BegMo & BegYr" and "EndMo & EndYr" My macro looks like this: BegMo = Range("E1") BegYr = Range("F1") EndMo = Range("G1") EndYr = Range("H1") Set pvtTable = Worksheets("Projection Summary").Range("D13").PivotTable With ActiveSheet.PivotTables("PivotTable1").PivotFields ("End Month-Year") .PivotItems(BegMo & " " & BegYr).Visible = True ActiveSheet.PivotTables("PivotTable1").PivotFields ("End Month-Year") .PivotItems(EndMo & " " & EndYr).Visible = True End With ..... The good news is I am able to interact with my values in "End Month-Year" by referencing concatenated "BegMo" and "BegYr", so at least that works. Help with this? Thanks, Ryan |
All times are GMT +1. The time now is 04:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com