0

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?

1 Answer 1

2

Try clearing the filter before your line :

 Sheet32.PivotTables("PivotTable11").PivotFields("Retail Division").ClearAllFilters
Sign up to request clarification or add additional context in comments.

1 Comment

That did it! Thanks so much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.