Excel VBA Macro Filter Selection Issue

  • Hi, I am tyring to create filter selection process using VBA macro, but for some reason, the value from a filtered field is not working. Please take a look at my code..




    When I filter on "B & L", it works. However, when I try to filter the "Purchase" and "Adjustment" I get an error MSG of "Run-time error'1004': Unable to set the Visible property of the PivotItem class.



    Please help..


    Thanks!!


    Moderator note: Please take a moment to review the rules regarding the use of code tags. I have added them for you this time, please use them in the future.

  • Wondering if you're having the same issue I did a while ago while filtering pivottables.


    First make all PivotItems Visible then do the filter. It might be that the PivotItem cannot be made visible because it cannot hide the others first. This is usually because a pivot must have at least 1 criteria visible; so unhide all needs to happen before the filtering.


    It could also be that either "Purchase" does not exist / has different characters e.g. "Purchase " (space) instead of "Purchase"

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!