Dynamic page breaks for Pivot Tables

BillXL

New Member
Joined
Oct 6, 2008
Messages
29
I’m trying to figure out a way of printing a Pivot Table and inserting page breaks in an ‘intelligent’ way.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

My pivot table is a list of employees, grouped by department.<o:p></o:p>
Some of the department fields have only one or two employees, others have more than 50. <o:p></o:p>

So I have a report of 20 departments and each department has a variable number of employees (rows).<o:p></o:p>

I don’t want to insert a page break after each field, as this would result in many pages being printed – some of which would only have 2 or 3 rows.<o:p></o:p>
Also, I’d rather avoid having a static row length for each page – because I would like the break to be after a subtotal where possible.<o:p></o:p>
<o:p></o:p>

What I have in mind is this. I’d like to set the maximum number of rows to 40 per page. Say I have the following departments & the total number of rows (employees & subtotal) is:<o:p></o:p>
Department A, 25 rows; Dept B, 4 rows; Dept C, 5 rows; Dept D, 10 rows.<o:p></o:p>
In this case, I’d like the page break to be place after Department C. (Total rows of the first 3 departments is 34. The next department has 10 rows, so the total is over 40.)<o:p></o:p>

This has to be dynamic. If the pivot table is refreshed and the Department A in the example has 20 rows instead of 25, then I’d like to have the page break after Department D. <o:p></o:p>
<o:p></o:p>
I should be able to figure out a VBA way to do this – but I am struggling to find a way to count the number of data items (i.e. employees) in each field.<o:p></o:p>
<o:p></o:p>
Any help would be greatly appreciated.<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
Many thanks<o:p></o:p>
<o:p></o:p>
Bill<o:p></o:p>
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Any ideas on this?

I thought I was closer to a solution - I have set the pivot table fields to display a blank line after each department. So I am now able to identify where each field begins and ends, but I am still stuck trying to group some fields together for printing.

Any thoughts?

Bill
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,287
Members
452,902
Latest member
Knuddeluff

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