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.
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:
- Select the cell range.
- Go to Home tab > Font group > Border drop-down > Borders section> All Borders.
The cell range now contains All Borders like the image below.
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:
- Select the cell range.
- Go to Home tab > Font group > Border drop-down > Draw Borders group > Draw Border Grid.
You will see a Pen icon on your worksheet. - Hover it on the cells where you need All Borders.
- Drag the pen to your desired data range.
- If done, press Esc to disable the border pen.
Finally, you have got All Borders on your selected cells.
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:
- Go to the Developer tab > Code group > Visual Basic to open the Visual Basic Editor. Or, press ALT+F11.
- Choose Module from the Insert tab to create a new module for writing your code.
- Copy and paste the following code:
Sub Border_Cells()
The above code in the VBA editor looks like the following image:
Range("B4,B5,B10,C7,C9").BorderAround LineStyle:=xlContinuous, Weight:=xlThin
End Sub
- Click on the Run Sub button or, press F5 on your keyboard.
You will find All Borders applied to the selected cells.
Download Practice Workbook
Get the sample file and try it yourself.
Conclusion
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
- How to Add Thick Box Border in Excel
- How to Add Cell Borders Inside and Outside in Excel
- How to Apply Bottom Double Border in Excel
- How to Add or Remove Dotted Border in Excel
<< Go Back to Cell Borders in Excel | Excel Cell Format | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!