VBA to insert/delete rows when expand/collapse overlap pivot tables

David Schaleger

Board Regular
Joined
Dec 6, 2010
Messages
55
Please help me with code that inserts or deletes an appropriate number of rows when expanding or collapsing pivot tables that would otherwise overlap another pivot table when expanded.

I have several pivot tables stacked on top of each other on one sheet, all with the same column headers (year.mo). I have two rows between each PT. When I expand fields in any PT, the code should probably count how many rows need to be inserted below the PT to accommodate the new PT height, and then insert them before expanding the field data, leaving two rows between the newly expanded PT and the one below it. The reverse should happen when collapsing, leaving two rows in between the PT's. This, of course, is not necessary with the last (lowest or bottom most) PT, although it shouldn't be a problem if it did, and would probably simplify the code

I'm starting to get a little savvy with VBA, but I SUCK at referencing PT's!

Thank you.
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top