variable page breaks

joemeshuggah

Board Regular
Joined
Jul 18, 2008
Messages
161
Is there a way to adjust page breaks based on variable criteria?

I have a macro that subtotals information by hierarchy (subtotals at the bottom)...column b is what is being subtotaled (the hierarchy) and column c is blank for the subtotal row (column c houses the employees that fall under each hierarchy). For example

Column: B C
Header Row:Hierarchy Employee ID
Data Row: Accounting 123
Data Row: Accounting 456
Subtotal Row: Accounting Total 2
Data Row: Facilities 789
Subtotal Row: Facilities Total 1

The standard page break is fine, however, I do not want a particular hierarchy to be split across a page...e.g. if a particular hierarchy is going to spill over onto the next page, I would like the page break to be below the previous hierarchy's subtotal. For example:

If the standard page break would occur like this:

Column: B C
Header Row: Hierarchy Employee ID
Data Row: Accounting 123
-------------------------------------------------
Data Row: Accounting 456
Subtotal Row: Accounting Total 2
Data Row: Facilities 789
Subtotal Row: Facilities Total 1

I would want the macro to recognize that the hierarchy is being split between pages and adjust so that all of the information appears on the next page.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,214,528
Messages
6,120,065
Members
448,941
Latest member
AlphaRino

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