Reputation: 539
I am trying to write out some VBA code to filter a pivottable of mine to show only records greater than 0.
When I run the code, I receive ther error "Application-defined or object-defined error".
I really have no idea what is causing the issue, so hoping for some assistance from you all!
Here's my code:
Sheet32.PivotTables("PivotTable11").PivotFields("Retail Division"). _
PivotFilters.Add Type:=xlValueIsGreaterThan, DataField:=Sheet32.PivotTables("PivotTable11").PivotFields("Sum of Recordable Injuries"), Value1:=0
Any ideas why the code is not running?
Upvotes: 0
Views: 125
Reputation: 596
Try clearing the filter before your line :
Sheet32.PivotTables("PivotTable11").PivotFields("Retail Division").ClearAllFilters
Upvotes: 2