How to Apply All Borders in Excel (3 Methods)

The All Borders option is a formatting feature that allows you to apply a border around the entire selected range of cells. This means that a border line will appear on all sides of each cell within the selected range, including the top, bottom, left, and right sides.

Overview of Applying All Borders in Excel

Method 1 – Using Excel’s Built-in Borders Option

  • Select the cell range where you want to apply borders.
    Selecting the Cell Range
  • Go to the Home tab, navigate to the Font group, and click the Border drop-down.
  • Choose All Borders from the options available.

Applying All Borders from Excel Ribbon

  • Your cell range will now have borders on all sides, as shown in the image below.

Result of Applying All Borders Using Excel Ribbon

Note: You can also apply All Borders using keyboard shortcuts by selecting the desired cells and pressing Alt + H + B + A.

Read More: How to Insert Border in Excel

Method 2 – Using the Draw Borders Feature

  • Select the cell range where you want to add borders.

Selecting Cell Range

  • Go to the Home tab, navigate to the Font group, and click the Border drop-down.
  • In the Draw Borders group, select Draw Border Grid.

Choosing Draw Border Grid

  • A pen icon will appear on your worksheet.
  • Hover over the cells where you want to apply borders.
  • Drag the pen to your desired data range.Applying Draw Border Grid
  • Once done, press Esc to disable the border pen.
  • You’ve now applied All Borders to your selected cells.

Output of Applying Draw Border Option

Note: You can further format the borders using the More Borders option from the Border drop-down.

Read More: How to Apply Top and Bottom Border in Excel

Method 3 – Using Excel VBA

Applying borders to non-contiguous cells can be cumbersome using the built-in Borders or Draw Border Grid options. An alternative approach is to use Excel VBA (Visual Basic for Applications). Follow these steps:

  • Go to the Developer tab, click the Code group, and open the Visual Basic editor (or press ALT+F11).

Opening Visual Basic Editor

  • Choose Module from the Insert tab to create a new module for your code.

Inserting New Module

  • Copy and paste the following VBA code:
    Sub Border_Cells()
    Range("B4,B5,B10,C7,C9").BorderAround LineStyle:=xlContinuous, Weight:=xlThin
    End Sub
    The above code in the VBA editor looks like the following image:Code in the VBA Window
  • Click the Run Sub button or press F5 on your keyboard.

Running the Code

  • You will find All Borders applied to the selected cells.

Output of Excel VBA Code

Download Practice Workbook

You can download the practice workbook from here:

Frequently Asked Questions

  • Does applying borders impact Excel performance? 

No, applying borders in Excel does not significantly impact performance or file size.

  • How do I remove borders in Excel? 

To remove borders, select the cells with borders, go to the Borders drop-down in the Home tab, and choose No Border.

  • How can I ensure consistent borders across multiple worksheets? 

Apply the desired borders in one sheet, copy the formatted cells, and then use the Paste Special option in other sheets to maintain formatting.

Related Articles

<< Go Back to Cell Borders in Excel | Excel Cell FormatLearn Excel

Get FREE Advanced Excel Exercises with Solutions!
Sanjida Mehrun Guria
Sanjida Mehrun Guria

Hello! Welcome to my blog. I have completed my Bachelor in Architecture from Ashanullah University of Science & Technology, Dhaka. I am a passionate, goal-oriented person with an immense thirst for knowledge and an attitude to grow continuously. Besides Architectural work, I find it very enthusiastic to work in Excel blogging. Exceldemy is a platform where I have got the opportunity to flourish my skill in Microsoft Excel and therefore, here I will be posting blogs related to... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF