Skip to main content

How to insert page break every x rows in Excel?

Author: Sun Last Modified: 2020-09-09

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

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:
doc-insert-page-break-x-rows-1

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!


ad insert page break every row 3

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


Kutools for Excel: Over 300 handy tools at your fingertips! Start your 30-day free trial with no feature limitations today. Download Now!

Relative Articles:

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

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...

Description


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!
Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello, Why is it limited to number. If my spreadsheet has more than 1000 rows it will not complete the page breaks for all rows after that point.
Thanks
This comment was minimized by the moderator on the site
Dear extendoffice.com
I would like to send feedback about feature: Print > Insert Page Break Every Row.

VBA Code:
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


When you use this function, you can only enter one variables is xRow.
So this feature will be almost useless because it is not flexible. Not all data start from Row 1, not to mention data usually is table and has Header row.

I think this feature should have another variable is xFirstRow, so that you can define the first row of data:
xFirstRow = Application.InputBox("First Row", xTitleId, "", Type:=1)

And the formula should be:
For i = xFirstRow + xRow + 1 To xLastrow Step xRow

Hopefully this feature will be upgraded in later versions.
Thanks,
Tuyen
This comment was minimized by the moderator on the site
Hi, Thanks a lot for the code. But when I press Cancel or x on the input box; the excel file crashes. Can you please help to resolve this issue.
This comment was minimized by the moderator on the site
Thanks a lot from Istanbul / Turkey :)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations