paulshlapa
New Member
Hi everyone,
I have a code, which works great with to filter out values in a pivot table, which is located on a different sheet, but i can not get it to work within a DataModel environment (Runtime 1004)
Any suggestions?
Thank you very much
I have a code, which works great with to filter out values in a pivot table, which is located on a different sheet, but i can not get it to work within a DataModel environment (Runtime 1004)
Code:
Sub Test_Filter()
Dim PI As PivotItem
With Worksheets("PIVOT ALL").PivotTables("PivotTable1").PivotFields("ID")
.ClearAllFilters
For Each PI In .PivotItems
PI.Visible = WorksheetFunction.CountIf(Range("Filter"), PI.Name) > 0
Next PI
End With
End Sub
Thank you very much