Hello All,

I’m looking for a VBA code to either expand parent fields where the child field (2nd level) is not eqaul to 0 or collapse fields at the parent level where the child field (2nd level) contains a value equal to 0. I have a parent field I always want to see (never contains a “0”), but some of the parent fields contain no additional data in the underlying fields. I want to keep the primary field visible, but if there is no data in the child fields, I don’t want that to appear in the pivot table (they show up as a 0 with the ability to expand or collapse). If I filer out 0’s, then anytime I go another level deep, the parent fields that contain 0’s in the children fields are filtered out with it.

Is there a way to keep the parent fields visible and have a macro collapse any parent field that contains no data? I’m pretty flexible with solutions, so if something like hiding the child rows with 0 data is the best solution, that would work. I just need help with the coding.

I realize that using 0 data in pivot tables should be avoided, but this was the best way to layout the data.
Any help would be appreciated as this has been keeping me up at night!