Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to print borders around each page in Excel?

Author Xiaoyang Last modified

When working with large worksheets that span hundreds of pages, printing the data in a clear and professional format becomes essential. One way to achieve this is by adding a border around each printed page, so that the printout is visually separated and easier to read. While you can manually select and apply borders to each page's content in Excel, this approach is extremely time-consuming and impractical when dealing with multiple pages. Fortunately, there are more efficient solutions to automatically print borders around every page in Excel. In this article, we'll explore several practical methods to accomplish this task, including both built-in options and alternative approaches.


Print borders around each page with setting gridlines

While Excel doesn't provide a dedicated option to add a border around each printed page, you can use the Print Gridlines feature to simulate page borders. This is quick and requires no add-ins. Note that it won't create a bold page outline—Excel prints all gridlines, and the page edge becomes visually defined by the last printed gridlines.

Notes:

  • This method works best when your worksheet fits a regular grid layout and you don’t rely on heavy custom borders.
  • If your sheet already uses distinctive borders for tables, printed gridlines may visually clash with them.

1. If custom borders exist, remove them first to avoid overlapping or inconsistent lines in print. Select the sheet, then go to Home > Border (icon) > No Border to clear borders for all selected cells:

click Home > Border icon > No Border

2. Go to Page Layout > click the Page Setup dialog launcher (small arrow in the group corner) to open the Page Setup dialog:

click Page Layout > Page Setup arrow

3. In Page Setup, switch to the Sheet tab and check Gridlines under the Print section so all gridlines (including those at page edges) are printed:

check Gridlines under Print section

4. Click Print Preview to confirm the result. When you print, each page shows a clear rectangular grid boundary formed by the outermost printed gridlines, mimicking a page border. See sample:

 a bold border around each pages will be printed

Tips:

  • If you need thicker, prominent borders, consider adding outer borders manually for the print area or using a macro to draw page outlines.
  • Avoid merged/irregular cell regions; they may break the visual continuity of printed gridlines.
  • Always preview before printing to ensure the appearance meets your expectations.
a screenshot of kutools for excel ai

Unlock Excel Magic with Kutools AI

  • Smart Execution: Perform cell operations, analyze data, and create charts—all driven by simple commands.
  • Custom Formulas: Generate tailored formulas to streamline your workflows.
  • VBA Coding: Write and implement VBA code effortlessly.
  • Formula Interpretation: Understand complex formulas with ease.
  • Text Translation: Break language barriers within your spreadsheets.
Enhance your Excel capabilities with AI-powered tools. Download Now and experience efficiency like never before!

Print borders around each page in one click with Kutools for Excel

For users who want a more professional-looking page border—especially in worksheets with complex formatting or when gridlines are insufficient—Kutools for Excel offers a convenient solution: the Add Border to Each Page feature. This tool allows you to add a solid border to every printable page of the active worksheet with just one click, saving time and ensuring a consistent appearance across all pages.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After installing Kutools for Excel, follow these steps to add borders to each page:

1. Activate the sheet where you want to add borders, then go to Enterprise > Printing > Add Border to Each Page. See screenshot:
Click the Add Border to Each Page feature in Kutools for Excel

2. If a dialog appears warning that all existing borders will be deleted if you continue, make sure you have saved your work or confirmed that overwriting borders is acceptable. Click Yes to proceed:
A dialog appears warning that all existing borders will be deleted

Once applied, each page of your worksheet will be outlined with a bold, clear border, making the printed output look organized and easy to distinguish. This method is fast and minimizes manual effort.
A border has been added around each page of the sheet

Tips and notes:

  • Existing borders will be removed from the active sheet when using this option.
  • If you need to keep specific borders, consider backing up your file or worksheet first.
  • This option works well for large worksheets with multiple print pages that require consistent and visually clear page borders.

Print borders around each page using VBA macro automation

If you want to automate adding a border around every printable page—especially for recurring tasks or custom layouts—you can use a VBA macro that reads Excel page breaks and draws a page outline. This gives you full control over border style and thickness without relying on add-ins.

Notes:

  • The macro outlines each printable page with a border on its outer edges only (top/left/bottom/right). It won’t overwrite existing internal cell borders.
  • Works best on well-structured sheets; complex merged cells or unusual print areas may need minor adjustments.

Operation steps:

1. Press Alt + F11 to open the Visual Basic for Applications editor. Click Insert > Module to add a new module.

2. Copy and paste the following code into the module:

Sub AddBorderToEachPrintablePage()
    Dim ws As Worksheet
    Dim LastRow As Long, LastCol As Long
    Dim StartRow As Long, EndRow As Long
    Dim StartCol As Long, EndCol As Long
    Dim vRowBreaks As Variant, vColBreaks As Variant
    Dim i As Long, j As Long
    Dim oldDisp As Boolean
    Dim f As Range

    Set ws = ActiveSheet

    Application.ScreenUpdating = False
    Application.EnableEvents = False

    ' Check if sheet is empty
    Set f = ws.Cells.Find(What:="*", LookIn:=xlFormulas, LookAt:=xlPart, _
                          SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False)
    If f Is Nothing Then GoTo CleanUp

    LastRow = ws.Cells.Find(What:="*", LookIn:=xlFormulas, LookAt:=xlPart, _
                            SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    LastCol = ws.Cells.Find(What:="*", LookIn:=xlFormulas, LookAt:=xlPart, _
                            SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column

    ' Force refresh of page breaks
    oldDisp = ws.DisplayPageBreaks
    ws.DisplayPageBreaks = True

    ' Collect horizontal page breaks (add top and bottom bounds)
    vRowBreaks = Array(0)
    For i = 1 To ws.HPageBreaks.Count
        vRowBreaks = ArrayJoin(vRowBreaks, Array(ws.HPageBreaks(i).Location.Row - 1))
    Next i
    vRowBreaks = ArrayJoin(vRowBreaks, Array(LastRow))

    ' Collect vertical page breaks (add left and right bounds)
    vColBreaks = Array(0)
    For j = 1 To ws.VPageBreaks.Count
        vColBreaks = ArrayJoin(vColBreaks, Array(ws.VPageBreaks(j).Location.Column - 1))
    Next j
    vColBreaks = ArrayJoin(vColBreaks, Array(LastCol))

    ' Draw only outer borders for each printable page
    For i = 0 To UBound(vRowBreaks) - 1
        StartRow = vRowBreaks(i) + 1
        EndRow = vRowBreaks(i + 1)
        For j = 0 To UBound(vColBreaks) - 1
            StartCol = vColBreaks(j) + 1
            EndCol = vColBreaks(j + 1)

            With ws.Range(ws.Cells(StartRow, StartCol), ws.Cells(EndRow, EndCol))
                With .Borders(xlEdgeTop)
                    .LineStyle = xlContinuous: .Weight = xlThick
                End With
                With .Borders(xlEdgeLeft)
                    .LineStyle = xlContinuous: .Weight = xlThick
                End With
                With .Borders(xlEdgeBottom)
                    .LineStyle = xlContinuous: .Weight = xlThick
                End With
                With .Borders(xlEdgeRight)
                    .LineStyle = xlContinuous: .Weight = xlThick
                End With
            End With
        Next j
    Next i

CleanUp:
    ws.DisplayPageBreaks = oldDisp
    Application.EnableEvents = True
    Application.ScreenUpdating = True

    If Not f Is Nothing Then
        MsgBox "Borders have been added to each printable page!", vbInformation, "AddBorderToEachPrintablePage"
    End If
End Sub

Function ArrayJoin(a As Variant, b As Variant) As Variant
    Dim temp() As Variant
    Dim alen As Long, blen As Long, k As Long

    alen = UBound(a) - LBound(a) + 1
    blen = UBound(b) - LBound(b) + 1
    ReDim temp(0 To alen + blen - 1)

    For k = 0 To alen - 1
        temp(k) = a(k)
    Next k
    For k = 0 To blen - 1
        temp(alen + k) = b(k)
    Next k

    ArrayJoin = temp
End Function

3. Return to Excel, make sure the target worksheet is active, and run the macro with F5 (or the Run button). The macro will detect page breaks and draw a thick border around each printable page block.

Tips:

  • Adjust border style/weight by editing the four xlEdge* sections (e.g., .Weight = xlMedium, color via .Color).
  • If a custom Print Area is set, Excel’s page breaks will follow it; verify results in Print Preview.
  • Save your workbook before running macros. For repeated use, save as a macro-enabled file (.xlsm).
  • If no content is found, the macro exits safely with a message (prevents errors on empty sheets).

If the macro doesn’t behave as expected, check for merged cells, hidden rows/columns, or unusual scaling settings (for example, “Fit to 1 page wide by N pages tall”). You can refine page blocks by changing your Print Area or Page Setup settings and rerun the macro.


Add Border Around Each Page

 

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
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

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!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

Excel Word Outlook Tabs PowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in