Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Application.EnableEvents = False
Worksheets("Sheet1").PivotTables("PivotTable1").PivotFields("MyField1").CurrentPage = Range("B5").Value
Application.EnableEvents = True
End Sub
*****************************************************
Public Sub ResetApplicationEvents()
Application.EnableEvents = True
End Sub
*****************************************************
Sub DeleteMissingItems2002All()
'prevents unused items in non-OLAP PivotTables
Dim pt As PivotTable
Dim ws As Worksheet
Dim pc As PivotCache
'change the settings
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
Next pt
Next ws
'refresh all the pivot caches
For Each pc In ActiveWorkbook.PivotCaches
On Error Resume Next
pc.Refresh
Next pc
End Sub
|