![]() |
Selecting a range of values on pivot table attribute with a macro
Hi,
I wonder if someone can help me create variable nuumber of months pivot table report based on start date and end date parameters set by the end user. I've gotten as far as list boxes that define 4 names for the the start and end dates: BegMo, BegYr, EndMo, EndYr and I have my data element "End Month-Year" in the pivot table. The following code allows me to set the table to the two start and end dates defined, but it fails to do two things: a) remove other preset values in "End Month-Year" and b) set "End Month-Year" to select all values between "BegMo & BegYr" and "EndMo & EndYr" Help with this? Ryan -- Stanford Research Administration Financial Management Analyst |
Selecting a range of values on pivot table attribute with a macro
Forgot to reference the offending code: ;^)
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 "Ryan Hartnett" wrote: Hi, I wonder if someone can help me create variable nuumber of months pivot table report based on start date and end date parameters set by the end user. I've gotten as far as list boxes that define 4 names for the the start and end dates: BegMo, BegYr, EndMo, EndYr and I have my data element "End Month-Year" in the pivot table. The following code allows me to set the table to the two start and end dates defined, but it fails to do two things: a) remove other preset values in "End Month-Year" and b) set "End Month-Year" to select all values between "BegMo & BegYr" and "EndMo & EndYr" Help with this? Ryan -- Stanford Research Administration Financial Management Analyst |
All times are GMT +1. The time now is 01:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com