

The upshot of this limit is that if you have quite a few page breaks to insert, the macro will crash when the page-break limit is exceded on the worksheet. (The limit can vary slightly based on the version of Excel you are using, but is right around that point.) Here's the obscure write-up about the limit: According to the Knowledge Base, that limit is around 1024 breaks.

#HOW TO INSERT PAGE BREAKS EXCEL MANUAL#
You should realize that Excel does have a limit when it comes to the number of manual page breaks that can be used in a worksheet. Run the macro, and any old page breaks are removed and new ones added. For instance, if the departments are in column A, rows 2 through 37, you would select the range in A3 through A37. To use the macro, simply select the cells you want to use as your key for doing the splits, minus the top cell. If TestCell.Value TestCell.Offset(-1, 0).Value ThenĪctiveSheet.Rows(TestCell.Row).PageBreak = xlPageBreakManual If, for some reason, you don't want to use the Subtotals feature, you can always write a macro that will remove all the page breaks in your worksheet, then add new page breaks at the appropriate places. Excel adds the subtotals and the page counts, as directed.
#HOW TO INSERT PAGE BREAKS EXCEL HOW TO#
Learn how to insert page breaks manually in your spreadsheet. If you find that you have straggling rows or columns in your spreadsheet you may need to insert a page-break at an earlier point in your spreadsheet. With any cell within the table still selected, choose Subtotals from the Data menu. This quick video will teach you how to insert Page Breaks manually in your spreadsheet.

Sort the data in your table, using the department column as the key.For instance, if column A contains the department names, then cell A1 could contain a label such as "Department." Make sure all the columns have labels. Make sure your table contains column labels.All you need to do is follow these steps: This is rather easy to do with the built-in Subtotals feature of Excel. For instance, you might have a column that contains department names, and you may want each department to start on a new page. Remove the check mark from 'Subtotal below data'. Add a check mark to 'Page break between groups'. Under 'Add subtotal to' select the column of first letters. As you work with your data, you may wonder how you can automatically insert page breaks when the contents of a certain column change. From the 'At each change in' dropdown, choose the column of first letters. Many people use it at work to create ad-hoc reports for different departments or projects. Excel is a handy tool for keeping track of all sorts of data.
