Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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

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! Full Feature Free Trial 60-day!

ad insert page break every row 3


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.


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 - Combines more than 300 Advanced Functions and Tools for Microsoft Excel

1. Click the Enterprise > Split to Columns.

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 - Includes more than 300 handy Excel tools. Full feature free trial 60-day, no credit card required! Get it now!


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 - Combines more than 300 Advanced Functions and Tools for Microsoft Excel

1. Select the range that you will insert page breaks after every x rows, and click the Enterprise > Printing > Insert Page Break Every Row.

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 - Includes more than 300 handy Excel tools. Full feature free trial 60-day, no credit card required! Get it now!


In this Video, the Kutools tab and the Kutools Plus tab are added by Kutools for Excel. If need it, please click here to have a 60-day free trial without limitation!



Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Tuyen · 10 months ago
    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
  • To post as a guest, your comment is unpublished.
    Emad · 4 years ago
    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.
  • To post as a guest, your comment is unpublished.
    Yalin · 4 years ago
    Thanks a lot from Istanbul / Turkey :)