![]() |
Resetting PivotFields
Hi yet again,
I am trying to run a macro that resets filters to single item selection with All as the default. Sub s_reset_chart() 'This Macro removes blank fields from the Pivot and resets the filters to Default Application.ScreenUpdating = False Application.StatusBar = "Resettimg Pivot Filters to Default." On Error GoTo 0 Set pt = Sheets(s_analysis).PivotTables("s_Data_Pivot") For Each vmycell In [s_graph_pages] ' Range that contains the Page Field names in the If vmycell.Value = "" Or vmycell.Value = 0 Then Exit For Set pf = pt.PivotFields(vmycell.Value) pf.AutoSort xlManual, vmycell.Value If vmycell.Value = [ay3].Value Then ' look for value and set default With pt.PivotFields(vmycell.Value) .CurrentPage = ("Input Raw Cost - Core") .EnableMultiplePageItems = False End With Else With pt.PivotFields(vmycell.Value) .CurrentPage = "(All)" .EnableMultiplePageItems = False End With End If pf.AutoSort xlAscending, vmycell.Value Next vmycell Application.StatusBar = "Filter Reset complete." Application.ScreenUpdating = True Application.StatusBar = False End Sub Maybe I should become a carpenter instead .. Any help appreciated. Best regards, Bony |
All times are GMT +1. The time now is 01:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com