How to insert page break every x rows in Excel?
It may be easy and simple for you to insert a page break into a worksheet. Sometimes, it's required to insert page breaks in every X rows for printing tidily, how could you do? Here I introduce a couple of methods to solve this problem in Excel.
- Insert page break every X rows with VBA in Excel
- Batch insert page breaks after every x rows
- Batch insert page breaks after every x rows with adding row heading above every x rows
Insert page break every X rows with VBA in Excel
Maybe you are not familiar with VBA running before, but with the follow steps you may know how to run the VBA to insert a page break every X rows. Here I will insert a page break in every 3 rows.
1. Press Alt + F11 to display the Microsoft Visual Basic for Applications window.
2. In the window, click Insert > Module to show a new module window, then copy the following VBA code into the module window.
VBA: Insert page break in every X rows in a worksheet.
Sub InsertPageBreaks()
'Updateby20140618
Dim xLastrow As Long
Dim xWs As Worksheet
Set xWs = Application.ActiveSheet
xRow = Application.InputBox("Row", xTitleId, "", Type:=1)
xWs.ResetAllPageBreaks
xLastrow = xWs.Range("A1").SpecialCells(xlCellTypeLastCell).Row
For i = xRow + 1 To xLastrow Step xRow
xWs.HPageBreaks.Add Before:=xWs.Cells(i, 1)
Next
End Sub
3. Click Run button and a dialog pops out for you to specify every X rows you want to insert a page break in. Here I insert page break in every 3 rows. See screenshot:
4. Click OK, and then it will insert a page break in every X rows.
Quickly insert page break every (nth) row in active worksheet
Normally we insert one page break with clicking Page Layout > Breaks > Insert Page Break. But this way it too tedious to batch insert multiple page breaks in a worksheet, such as you need to insert one page break every row for printing each row in a separate page. Don’t Worry! Kutools for Excel’s Insert Page Break Every Row utility can help you easily archive it!
Batch insert page breaks after every x rows with Kutools for Excel
If you have Kutools for Excel installed, its Split to Columns utility can help you batch insert multiple page breaks after every x rows with keeping title in each page easily in Excel.
Kutools for Excel - Packed with over 300 essential tools for Excel. Enjoy a full-featured 30-day FREE trial with no credit card required! Download now!
1. Click Split to Columns on the Kutools Plus tab.
2. In the opening Split to Columns dialog box, you need to:
(1) Click the Browse button in the Titles range box, and select the title row in the specified range that you will batch insert page breaks.
(2) Click the Browse button in the Date range box, and select the range that you will batch insert page breaks.
(3) In the Rows per printed page box, enter a number. (Tip: For example, if you need to insert page breaks after every 3 rows, please enter 3 into the box; if you need to inert page breaks after every row, please enter 1.)
(4) Enter 1 into the Number of segments box.
3. Click the Ok button.
Now you will see the range is copied into a new worksheet, and page breaks are added after every x rows with keeping range title. You can also switch to the Page Break Preview view by clicking View > Page Break Preview to see these page breaks. See below screen shot.
Kutools for Excel - Supercharge Excel with over 300 essential tools. Enjoy a full-featured 30-day FREE trial with no credit card required! Get It Now
Insert page breaks after every x rows with Kutools for Excel
Kutools for Excel develops another Insert Page Break Every Row utility specializing in inserting page breaks after every x rows at ease.
Kutools for Excel - Packed with over 300 essential tools for Excel. Enjoy a full-featured 30-day FREE trial with no credit card required! Download now!
1. Select the range that you will insert page breaks after every x rows, and click Printing > Insert Page Break Every Row on the Kutools Plus tab.
2. In the opening Insert Page Break Every Row dialog box, specify the interval of rows that you will insert page breaks at, and click the Ok button.
Then you will see page breaks are inserted at the specified interval of rows at once.
Kutools for Excel - Supercharge Excel with over 300 essential tools. Enjoy a full-featured 30-day FREE trial with no credit card required! Get It Now
Demo: insert page break every x rows in Excel
Relative Articles:
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!