Hi all,
Please help.
Currently I am using programmed date range filter for pivot table in Excel 2003. I would like to make it work for several pivot tables on one spreadsheet coming from one data source. Does anyone have an idea how to make it work for several pivot tables at once?
Here is the code I am currently using:
![]()
Sub FilterPivotDates() Dim dStart As Date Dim dEnd As Date Dim pt As PivotTable Dim pf As PivotField Dim pi As PivotItem Application.ScreenUpdating = False On Error Resume Next dStart = Sheets("SalesPivot").Range("StartDate").Value dEnd = Sheets("SalesPivot").Range("EndDate").Value Set pt = ActiveSheet.PivotTables(1) Set pf = pt.PivotFields("Date") pt.ManualUpdate = True pf.EnableMultiplePageItems = True For Each pi In pf.PivotItems pi.Visible = True Next pi For Each pi In pf.PivotItems If CDate(Replace(pi.Value, ".", "/")) < dStart Or CDate(Replace(pi.Value, ".", "/")) > dEnd Then pi.Visible = False End If Next pi Application.ScreenUpdating = False pt.ManualUpdate = False Set pf = Nothing Set pt = Nothing End Sub











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks