How to Apply All Borders in Excel (3 Quick Ways)

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 borderline will appear on all sides of each cell within the selected range, including the top, bottom, left, and right sides.

In this Excel tutorial, you will learn to apply All Borders.

Here, on the left of the image, cells don’t have borders, but on the right, borders are added using the All Borders option.

Overview of Applying All Borders in Excel

Here are the 3 ways to apply All Borders in Excel:

Using Excel Built-in Borders Option

To insert All Borders using the built-in Borders option, follow the steps below:

  1. Select the cell range.Selecting the Cell Range
  2. Go to Home tab > Font group > Border drop-down > Borders section> All Borders.Applying All Borders from Excel Ribbon

The cell range now contains All Borders like the image below.

Result of Applying All Borders Using Excel Ribbon

Note: To apply All Borders using keyboard shortcuts, select the desired cells and press Alt + H + B + A.

Read More: How to Insert Border in Excel

Using the Draw Borders Feature

Using the Excel Built-in Borders option to apply All Borders to non-contiguous cells is inefficient. You are required to repeat the same procedure multiple times. To resolve this, you can utilize the Draw Borders feature.

To use the Draw Borders feature, follow the steps below:

  1. Select the cell range.Selecting Cell Range
  2. Go to Home tab > Font group > Border drop-down > Draw Borders group > Draw Border Grid.Choosing Draw Border Grid
    You will see a Pen icon on your worksheet.
  3. Hover it on the cells where you need All Borders.
  4. Drag the pen to your desired data range.Applying Draw Border Grid
  5. If done, press Esc to disable the border pen.

Finally, you have got All Borders on your selected cells.

Output of Applying Draw Border Option

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

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

Using Excel VBA

Applying borders to non-contiguous cells can be problematic using the built-in Borders or Draw Border Grid. You have to select different cells and follow the same steps repeatedly. A better alternative is to use Excel VBA. You need to give the cell references in the code and run it to get the output.

To apply all borders in Excel using VBA, follow the steps below:

  1. Go to the Developer tab > Code group > Visual Basic to open the Visual Basic Editor. Or, press ALT+F11.Opening Visual Basic Editor
  2. Choose Module from the Insert tab to create a new module for writing your code.Inserting New Module
  3. Copy and paste the following 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
  4. Click on 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

Get the sample file and try it yourself.


In this article, we have used built-in Borders, keyboard shortcuts, the Draw Border Grid option, and VBA code to apply All Borders in Excel. If you face any problems, let us know your feedback in the comment box.

Frequently Asked Questions

Does applying borders impact Excel performance?

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

How to remove borders in Excel?

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

How to 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