Hi, I have macro which perfectly works on Excel 2010 (it filters values based on an external list). I tried the same on a different file on Excel 2013 but I get "400" error.
Sheet and range names are 100% correct. No typo. Another difference is that in a second file I use external pivot source (not internal). Maybe that is the issue not Excel version? Is there any workaround?
Sub Filtrowanie()
Dim PI As PivotItem
Application.ScreenUpdating = False
With Worksheets("zbiory").PivotTables("PivotTable1").PivotFields("nr_klienta")
.ClearAllFilters
For Each PI In .PivotItems
PI.Visible = WorksheetFunction.CountIf(Range("klienci"), PI.Name) > 0
Next PI
End With
Application.ScreenUpdating = True
End Sub
I got "400" error, so I put this:
Sub Filtrowanie()
Dim PI As PivotItem
On Error GoTo Errorcatch
Application.ScreenUpdating = False
With Worksheets("TRACKER_R2").PivotTables("PivotTable1").PivotFields("Promotion Code")
.ClearAllFilters
For Each PI In .PivotItems
PI.Visible = WorksheetFunction.CountIf(Range("promocje"), PI.Name) > 0
Next PI
End With
Application.ScreenUpdating = True
Errorcatch:
MsgBox Err.Description
End Sub
and I got:
Unable to get the PivotFields property of the PivotTable class
Is it possible that the root cause is external pivot source (external link to OLAP cube)?
Bookmarks