How to Add, Change and Format Cell Borders in Excel [Ultimate Guide]

In this Excel tutorial, you will learn how to add, change, format, draw, remove, and create custom styles for cell borders in Excel, and even how to work with Excel cell borders using VBA code. This is the ultimate guide on Excel cell borders. Read the whole guide step by step, you will be a master on this topic.

adding cell borders in excel cells

How to add All Borders to the Excel cells [Click on the image for a detailed view]

You will learn what are the different types of borders you can apply to Excel cells, how to draw and erase borders, how to use borders from the  Format Cells dialog box, or with the Keyboard shortcut, or working with Excel cell borders with Excel VBA. Here are the topics you will learn:

  • Adding cell borders to Excel cells
  • Changing cell borders
  • Formatting cell borders
  • Customizing cell borders
  • Removing cell Borders from Excel cells

Note: We have used Microsoft 365 while preparing the content. However, the following operations are applicable to the older versions.

Sometimes Excel spreadsheets get challenging to understand because of complex structures and massive datasets. In that case, we can apply cell borders in Excel to improve data representation, organization, visual clarity, and readability.

In the below sections, you will learn how to add borders to Excel cells and how to change, format, customize, and remove borders from Excel cells using built-in Excel features, keyboard shortcuts, and Excel VBA.

How to Add Cell Borders in Excel

We’ll use a sample dataset containing Order Date, Customer, Product, and Sales (USD). As you can see in the below image, there is no borderline in the dataset. We will apply borders in the following dataset by using 5 methods: adding cell borders using the Borders command, Format Cells dialog box, Keyboard shortcut, the Draw command, and Excel VBA code.

sample dataset for borders in excel

1. Applying “Borders” Command

We can easily add borders using the Borders command from the Font group of the Home tab. You will get different types of border options there. We’ll apply the All Borders for our dataset.

  • Initially, select the B4:E17 range.
  • Then click as follows:  Home tab >> Font group >> Border drop-down >> All Borders option.

Inserting all borders among Excel cells

  • We get all cells now with borders like the following image.

Inserted cell borders

2. Using the “Format Cells” Dialog Box

We can add borders also using the Format Cells dialog box.

  • Initially select the B4:E17 range >> press the Ctrl+1 keys to open the Format Cells dialog box. You can also open the Format Cells dialog box with this route: Home >> Font group of commands >> Click on the drop-down part of the Borders command and >> A list of options will appear >> Finally select the last option in the list More Borders…

Selecting dataset and pressing the keyboard shortcut to open the Format Cells dialog box.

  • Format Cells dialog box appears.
  • Format Cells window => Select the Border Line Style (I choose one, you can choose as per your preference) >> From the Presets, I choose Outline and Inside both options

Inserting borders from the format cells dialog box

  • Click on the OK button. You see all the Excel cells are now with borders like the image below:

Borders added among Excel cells

3. Using Keyboard Shortcut

You can use a keyboard shortcut to apply cell borders in Excel. The shortcut is Ctrl + Shift + &. But the keyboard shortcut is only applicable for adding the Outside thin borders.

  • First, select the range >> press the Ctrl + Shift + & buttons sequentially.

adding outside thin borders with Excel keyboard shortcut

4. Drawing Borders in Excel Cells Wherever You Need

You can add borders in any position by using the Draw Border command. In this case, you must drag the Mouse over the desired range area. Using the Draw Border option allows you to add borders in any portion of the dataset.

  • Go to Home tab >> Font group >> Borders drop-down >> Draw Border option.

Using Draw Border command

  • Thus we add an outside thin border around the B4:E4 range by dragging the pen. Similarly, we can add borders among the rest of the cells too.

Dragging to add outside thin borders

  • See how easily you can add borders to any cells in Excel

how to draw borders in excel cells

5. Using Excel VBA Code

To apply borders to a huge dataset, VBA can be an excellent approach. Applying a simple VBA code we can insert borders in multiple worksheets, even in multiple workbooks.

Note: If you’re very beginner with Excel, avoid using VBA code.

  • In the following dataset, we will insert borders using the VBA code.

sample dataset to add borders

Sub Add_Borders()
Set Rng = Range("B4:E17")
For i = 1 To 14     'calling rows from the range under For loop
    For j = 1 To 4      'calling columns from the range under For loop
        Rng.Cells(i, j).BorderAround LineStyle:=xlContinuous, Weight:=xlThin
            'adding thin borders among cells
    Next j
Next i
End Sub

Utilizing the Excel VBA macro tool to add borders among cells

What are the Different Types of Cell Borders Available in Excel?

As you can see in the image below, we applied a Thick Outside Border in the B4:E9 range. In addition, there are some types of borders. They are:

  • Top Border
  • Bottom Border
  • Top and Bottom Border
  • Bottom Double Border
  • All Border
  • Top and Double Bottom Border
  • Thick Outside Border
  • Thick Bottom Border

You may need to apply different types of borders to differentiate among data even sometimes to visualize the outcome clearly. Nevertheless, we can change border types of any range using the Borders command of the Home tab.

Different types of cell borders in Excel

How to Format the Cell Borders in Excel?

In this section, we will explain how to format cell borders in Excel changing the border line color and adjusting the border line width.

1. Changing Border Line Color

You can change border color in 3 ways: Borders command, Format Cells, and Excel Options dialog box.

Changing cell border line color using Excel Borders command

  • By selecting the Line Color from the drop-down list of the Borders icon, you will be able to change the color of the border.

Alternative: There are 2 other alternatives to changing the border color in Excel:

Using Format Cells Dialog Box

  • Keyboard shortcut to open the Format Cells dialog box in Excel: Ctrl + 1 keys or CTRL + SHIFT + F. You can also click on the Font Settings icon at the bottom right corner of the Home => Font group of commands.Excel Font settings icon
  • Whatever way you use, you get the Format Cells dialog box like the image below => Go to the Border tab => Then choose your desired color from the Color section.

Changing border line color with format cells dialog

Using Advanced Display Options

  • Select as follows: File tab >> Options menu. Or, simply press the Alt + F + T keys to go to the Excel Options dialog box.
  • Then select a color from the Gridline color section. This will change all the gridlines for the selected worksheet:

Changing border line color with Advanced Display options

  • Worksheet cell color changed from the default colorWorksheet gridlines color change with Excel Options


2. Adjusting Border Line Width

From the Format Cells dialog, we can change the borderline width. We will show you the process of changing the border width of the following dataset.

sample dataset to change cell border width

  • Select cell range >> press Ctrl+1 to open the Format Cells pop-up window. We apply some Border => Line => Style like the following image. Here, we applied thick outside and inside borders as shown in the image below.

Changing border width

  • This is the output of our actions:

Inserting thick borders among cells.

How to Create a Custom Style for Cell Borders in Excel

When you need a customized border style frequently, you can create your own in Excel. MS Excel offers border customization using the Cell Styles command.

Here are the steps to make your own Custom Style for Cell Borders:

  • Go to the Home tab >>  Cell Style drop-down >> New Cell Style option.

Creating custom cell border style

  • The Style dialog box will open => Rename the Style name as New_Border_Style

Renaming Style name, hitting the Format button

  • Click on the Format button => the Format Cells dialog box open => Now change the border line style, color, and presets of the cell

Formatting border style with Format Cells dialog

  • Hit the OK button. This will create a new custom style for this style name: New_Border_Style. You can find this new style under the Home => Styles => Cell Styles drop-down list.
  • Selecting the range and clicking the New_Border_Style button, you will be able to add custom-created borders.

Selecting the custom new command

How to Remove Cell Borders in Excel

After applying borders, you may need to remove those borders when they are not necessary or useful anymore in our Excel spreadsheets. So, we’ll show 3 quick ways to do it. They are the No Border command, keyboard shortcut, and Erase Border command.

1. Using No Border Command

You can remove borders by selecting the range and clicking the No Border option from the drop-down list of the Border command. Therefore, all the borders among cells will vanish at a time.

  • So, select the B4:E17 range and click as follows: Home tab >> Borders command >> No Border option.

Selecting No Borders command

  • Thus, all the border is removed from the dataset.

Borders don't exist among excel cells

Note: You can also use the Format Cells dialog box to remove borders from the cells. Select the cells from where you want to remove the borders => Open the Format Cells dialog box => select Border tab => From the Presets, choose the None option => Borders of the cells will be removed.remove borders from excel cells using format cells dialog box

2. Applying Keyboard Shortcut

The keyboard shortcut to remove borders from Excel cells is Ctrl + Shift + Minus (-). By pressing the keys all together, we can erase borders from the dataset. You may consider the process as an alternative option to the previous methods.

applying Excel Keyboard shortcut to remove cell borders

3. Using Erase Border Command

The Erase Border command will not remove all the borders automatically. It will erase the borders according to your selection of cells.

  • Select the range and click as follows, Home tab >> Borders drop-down>> Erase Border command.

Using Erase Border command

  • By dragging the Erase icon through cell borders, you will be able to erase any border you want.

Erasing borders

  • For a better understanding, you can check the video below:

Things to Remember

  • Borders icon from the Home tab of the Top Ribbon to add and remove borders from the dataset.
  • By pressing the Ctrl+1 keys you can simply get the Format Cells dialog box to add or remove borders.
  • Border Line color can be selected from the Borders command, Context menu, and Excel options dialog box.
  • Draw Border and Erase Border option to create borders and remove borders in specific cells.
  • Cell Styles command is useful in terms of creating custom borders.

Frequently Asked Questions

1. Where is the borders menu in Excel?

Answer: The Borders command is located in the Home tab of the Excel worksheet. There is a list of border styles, by selecting them you can insert borders easily.

2. What is the default border in Excel?

Answer: The No Border is the default border in Excel. However, you can add or change any border style.

3. How to take a Printout with Borders in Excel?

Answer: First, select the Excel worksheet that we want to print. Now, select as follows,

  • Go to the Page Layout tab >> Select the Sheet Options command >> Check the Print option under the Gridlines Category.
  • Finally, press the Ctrl+P keys to take a printout with the border formatting.

Download Practice Workbook


We hope this article made it easier to understand how to add or remove borders by using the Borders command, Format Cells dialog box, Keyboard shortcut, and Excel VBA Macro. Additionally, we can insert and erase borders at specific cells using the Draw Border and Erase Border commands respectively. You can also use the Cell Styles command to create a customized border style in Excel when you need a specific type of border. Don’t forget to leave your thoughts and queries in the comment section or in our forum.

More Articles on Excel Cell Borders

Get FREE Advanced Excel Exercises with Solutions!
MD Tanvir Rahman
MD Tanvir Rahman

MD Tanvir Rahman, BUET graduate in Naval Architecture and Marine Engineering, dedicated over a year to the ExcelDemy project. He is an Excel and VBA Content Developer. Having authored 50+ insightful articles, he actively updates and improves over 80 articles, reflecting his commitment to accuracy and currency, managing day-to-day operations, and analyzing and developing Excel and VBA tutorials. His broad interests encompass Data Analysis, Advanced Excel, VBA Macro, Excel Templates, Excel Automation, and Excel Power Query, showcasing a... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF