ThisCalculator

Everyday

Excel Count Page Breaks: How to See, Add, Remove

Updated · Standard formula, shown below

Excel Count Page Breaks: How to See, Add, Remove

Excel does not have a built-in function that directly counts page breaks, but you can quickly see them in Page Break Preview and manually count them, or use a simple VBA macro to get an exact number. This article explains the different types of page breaks, how to view and manage them, and how to get a precise count when you need it.

What Are Page Breaks in Excel?

Page breaks are the invisible dividers that tell Excel where one printed page ends and the next begins. They are determined by the paper size, orientation, margins, scaling, and the print area you have set. Excel supports two kinds:

  • Automatic page breaks – Excel inserts these based on your current print settings. They appear as dashed lines in Page Break Preview and move automatically if you change column widths, row heights, or scaling.
  • Manual page breaks – You insert these yourself, either horizontally or vertically, to force a section onto a new page. They appear as solid lines and stay fixed until you remove them.

How to See Page Breaks

To view page breaks, switch to Page Break Preview:

  1. Open your workbook and go to the View tab.
  2. Click Page Break Preview (it’s next to Normal and Page Layout).
  3. Excel zooms out and shows blue dashed lines for automatic breaks and solid blue lines for manual breaks.

This view is also where you can drag the lines to adjust manual breaks. To return to the normal view, click Normal on the View tab.

How to Count Page Breaks Manually

In Page Break Preview, you can count the lines yourself. Each dashed or solid blue line represents one page break. For a small worksheet this is easy, but for large reports it gets tedious and error-prone. A more reliable method is to use a macro.

Count Page Breaks with VBA

If you need an exact count, a short VBA macro can do it. Here’s how:

  1. Press Alt+F11 to open the VBA editor.
  2. Go to Insert > Module.
  3. Paste the following code:
Sub CountPageBreaks()
    Dim ws As Worksheet
    Dim hCount As Long, vCount As Long
    Set ws = ActiveSheet
    hCount = ws.HPageBreaks.Count
    vCount = ws.VPageBreaks.Count
    MsgBox "Horizontal breaks: " & hCount & vbCrLf & _
           "Vertical breaks: " & vCount & vbCrLf & _
           "Total: " & (hCount + vCount)
End Sub
  1. Press F5 to run it. A message box shows the counts.

Note that this counts only manual page breaks. Automatic breaks are not included in the HPageBreaks and VPageBreaks collections. If you want to know the total number of printed pages, use the ExecuteExcel4Macro method or simply check the print preview.

Common Problems and Misconceptions

One common misconception is that the number of page breaks equals the number of pages minus one. That is true only if every page break is a full break across the sheet. In reality, you can have a horizontal break and a vertical break that cross, creating four pages with just two breaks. Also, a page break can be partial if you’ve set a print area that doesn’t cover the whole sheet.

Another frequent issue: page breaks appear in the wrong place. This usually happens because the print area is set incorrectly, or because the scaling option “Fit to� is active. When you use “Fit to 1 page wide by 1 tall,� Excel ignores manual breaks and may compress everything onto one page. To fix, go to Page Layout > Scale to Fit and set it to “Automatic.�

How to Add and Remove Page Breaks

To insert a manual break:

  1. Select the row below where you want the horizontal break (or the column to the right for a vertical break).
  2. Go to Page Layout > Breaks > Insert Page Break.

To remove a single break, select the same row/column and choose Remove Page Break. To remove all manual breaks, go to Breaks > Reset All Page Breaks.

Alternatives to Counting Page Breaks

If your goal is to know how many pages the sheet will print, you don’t need to count breaks at all. Use the Print Preview (File > Print) – it shows the total page count at the bottom left, like “Page 1 of 12.� That number includes both automatic and manual breaks, and it updates live as you change settings. This is the simplest way to know the final page count.

Frequently Asked Questions

Does Excel have a built-in function to count page breaks?

No. There is no worksheet function like =COUNTBREAKS(). You must either count visually or use VBA.

Why do my manual page breaks disappear?

Manual breaks are removed when you choose “Reset All Page Breaks,� or when you change the print area. They also vanish if you open the file in a different version of Excel that recalculates breaks differently.

Can I count page breaks without VBA?

Yes, you can count them visually in Page Break Preview. For a large sheet, you could also use the print preview page count, which tells you the total pages, not the breaks.

Do page breaks affect the file size?

No, page breaks are just print settings; they don’t add data or increase file size.

How do I make all rows fit on one page?

Go to Page Layout > Scale to Fit, and set the height to “1 page.� Excel will scale the printout to fit one page tall. This overrides manual breaks.

Why is there a dashed line in the middle of my data?

That’s an automatic page break. It appears because the content to the right or below would not fit on the current page with your current margins and paper size. You can drag it in Page Break Preview to turn it into a manual break.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.