Below is the macro code. The code automatically updates pivot filters across the sheets in a workbook. It works perfectly fine in Excel 2007 on a PC. It does not work at all on Excel 2011 on a Mac.
A few more details.
- There are hidden sheets that have pivot tables
- The un-hidden sheets have pivot tables as well and they have filters that when changed, change data on the hidden sheets, which then produces new graphs on the un-hidden sheets.
- The pivot table filters on the un-hidden sheets on the mac just look like regular cells - they don't have the drop down that the filters on the PC versions have. The macro code is still there on the Mac files, but it's almost like the macro completely breaks the pivot table filter on the mac.
Any help would be very much appreciated. Thanks!!
Option Explicit
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
On Error Resume Next
Dim wsMain As Worksheet
Dim ws As Worksheet
Dim ptMain As PivotTable
Dim pt As PivotTable
Dim pfMain As PivotField
Dim pf As PivotField
Dim pi As PivotItem
Dim bMI As Boolean
On Error Resume Next
Set wsMain = ActiveSheet
Set ptMain = Target
Application.EnableEvents = False
Application.ScreenUpdating = False
For Each pfMain In ptMain.PageFields
bMI = pfMain.EnableMultiplePageItems
For Each ws In ThisWorkbook.Worksheets
For Each pt In ws.PivotTables
If ws.Name & "_" & pt <> wsMain.Name & "_" & ptMain Then
pt.ManualUpdate = True
Set pf = pt.PivotFields(pfMain.Name)
bMI = pfMain.EnableMultiplePageItems
With pf
.ClearAllFilters
Select Case bMI
Case False
.CurrentPage = pfMain.CurrentPage.Value
Case True
.CurrentPage = "(All)"
For Each pi In pfMain.PivotItems
.PivotItems(pi.Name).Visible = pi.Visible
Next pi
.EnableMultiplePageItems = bMI
End Select
End With
bMI = False
Set pf = Nothing
pt.ManualUpdate = False
End If
Next pt
Next ws
Next pfMain
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Bookmarks