5 Ways to Add Cell Borders in Excel Inside and Outside

Let’s say you want to set internal and external cell borders in your Excel data set. Several Excel features make this very easy to accomplish. You can quickly and easily insert cell borders using the Border features, VBA code, Format Cells option, and Keyboard Shortcuts. In this article, we’ll go over 5 quick and simple approaches for creating inside and outside cell borders in Excel spreadsheets.

Here’s a look at the big picture before and after we started inserting cell borders.

Before and after inserting the cell borders


📁 Download Excel File

Download the Excel file we used to create this article so you can practice.


How to Add Borders in Excel

There is a feature of Excel called Borders, which contains different types of border options. In this section, we are going to demonstrate how to add Thick Outside Borders. You can follow these steps to add different borders, too. Follow the steps below.

⬇️⬇️ STEPS ⬇️⬇️

  • First, select the cells to which you want to add borders. Here, we have selected the cell range B5:D20.

Select cells to insert cell borders

  • Then, go to the Menu Bar, and click on the Home tab.
  • From the Fonts group, click on the Borders icon.
  • Then, select the Thick Outside Border option.

Insert thick outside borders

  • You can see the cells, that you have previously selected a thick outside border now.

Thick outside border inserted


Learn to Add Inside and Outside Cell Borders in Excel with These 5 Easy Ways

It is possible to add cell borders in Excel both inside and outside of selected data cells using Excel’s features. In this article, we went over 5 distinct ways to insert cell borders. We used a dataset consisting of student information including Names, Student IDs, and Majors.

Introducing the dataset

Approach

1. Add Inside and Outside Cell Borders from Format Cells Option

There is an Excel feature named Format Cells. We are going to use this feature to insert borders. To learn more, follow the steps below.

⬇️⬇️ STEPS ⬇️⬇️

  • First, select the cells where you want to put cell borders. We have selected cells B5:D20.

Open format cells option

  • Then, on your keyboard, press Ctrl+1 to open the Format cells window.
  • A window of Format Cells has opened. From there, select the Border option.
  • Now, to put outside borders in your selected dataset, you have to choose the option Outline, and then press OK.

Select outline border to add outside cell border

  • As a result, you will see an outside border in your selected data.

Outside cell border inserted

  • Then, if you also want to put borders inside your selected cells, again open the Format Cells window with the keyboard command Ctrl+1.
  • Select the Inside option this time and press OK.

Inserting Inside border

  • Due to this, you will see inside borders added in your selected dataset.

Inside cell borders inserted

Approach

2. Use Border Feature to Add Cell Borders

There are different Border formats in Excel that you can use to add cell borders. In this approach, we are going to use two types of borders. Follow the steps below to learn more about them.

⬇️⬇️ STEPS ⬇️⬇️

  • To begin with, select the cells that we want to put the cell border around. We have selected cells B5:D20.
  • After that, go to the Menu Bar.
  • From there, select the drop-down Borders option from the Font group.
  • Then, among all the border options, select Outside Borders.

Inserting outside borders

  • As a result, you will be able to see the outside border around your selected dataset.

Outside borders inserted

  • Then, if you want to put inside cell borders, repeat the preceding steps and reopen the border options.
  • This time, select the All Borders option.

Inserting inside borders

  • Due to this, you can see that the selected entire dataset now has both inside and outside cell borders.

Inside and outside borders added

Approach

3. Keyboard Shortcut to Add Inside & Outside Cell Borders

There is another quick and easy way to add cell borders. You just have to know some keyboard shortcuts. In this approach, we are going to discuss those and show you how to use the keyboard to add both inside and outside cell borders.

⬇️⬇️ STEPS ⬇️⬇️

  • First, select the dataset where you want to add a border.
  • After that, go to your keyboard and type Ctrl+Shift+&. This is the shortcut to insert outside borders.

Cells selected to insert cell borders using keyboard shortcut

  • Therefore, you will be able to see the outside borders of your selected dataset.

Added outside cell border

  • Alternatively, you can also press Alt+H+B+S to insert the outside cell borders.
  • Now, again, if you also want to insert the inside cell borders, select the cells as before and then press Alt+H+B+A from your keyboard.

Use keyboard shortcut to add inside borders

  • After this, you will be able to see inserted cell borders inside the cells.

Borders are added using keyboard shortcuts

Approach

4. Draw Inside and Outside Borders Manually

Excel also allows you to draw borders manually. This method can be very useful when you want to add borders only to some selected cells. If you want to know how to use this feature, follow the steps below.

⬇️⬇️ STEPS ⬇️⬇️

  • First, go to the Menu Bar, and from there, click on the tab named Home.
  • After that, select the Borders option from the group Font.
  • Then, among all the border options, you can see an option named Draw Borders.

Drawing border manually

  • Then, select Draw Border option.
  • Now, you can see dots all over your worksheet. And you will have a Pen icon to draw borders by joining these dots.

Draw border manually using the Pen icon

  • Finally, use this icon and add borders outside and inside where you want to add borders. Both inside and outside borders can be drawn using this.

Borders are inserted manually using a pen icon

Approach

5. Apply VBA Macro for Cell Borders

VBA code can be used to add cell borders. It is a very useful method when you are dealing with a huge amount of data and adding borders manually seems like a hassle. Use the code that we have used, You can also modify this code according to your needs. Follow the steps below to learn more.

⬇️⬇️ STEPS ⬇️⬇️

  • First of all, right-click on the worksheet where you want to insert the VBA code.

Opening Visual Basic for application editor

  • After that, a Microsoft Visual Basic for Applications window will open.
  • From there, go to the Menu Bar and then click on Insert.
  • From the options that appear, select the Module.

Inserting Module from the VBA editor

  • Now you can see that a module has been created, and paste the code below into this module.
Sub Add_Inside_Outside_Borders()

    Dim range As Range

    Set range - Selection

    With range.Borders

        .LineStyle = xlContinuous

        .Weight = xlThin

        .Color = RGB(0, 0, 1)

    End With

End Sub

🔨 Code Breakdown

👉  Set range = Selection is used to assign the variable range a value from the user’s selection of range from the worksheet.

👉  .LineStyle = xlContinuous defines the type of lines that we are going to see as borders. We have used a continuous line.

👉  .Weight = xlThin represents border type, whether it is thick or thin.

👉  .Color = RGB(0, 0, 1) is used to define the border color and we have used black color, so (0, 0, 1)  is the code for black.

Code pasted in inserted module

  • Now, go to the worksheet again and select all the cells. From the Menu Bar go to the Developer option.
  • After that, from the Code group select Macros.

Select VBA Macro to run

  • As a result, a window will open, select the Macro Name and then press Run.

Running code from macros

  • You will see borders inserted both inside and outside of the selected cells.

VBA code inserts borders in selected cells


How to Remove Cell Borders in Excel

Suppose you want to remove existing borders from your dataset. There are several ways to remove cell borders but in this article, we are going to discuss only one method. The steps are given below.

⬇️⬇️ STEPS ⬇️⬇️

  • First, select the dataset, including borders.
  • After that, go to the Menu Bar, and from there, select the Home option.
  • Then, go to Font group and select Borders drop-down menu.
  • After that, you can now see various border options; among these, select the No Border option.

Select the no borders option to remove cell borders

  • As a result, you can see that there is no border in your selected cells.

Borders are removed


📝 Takeaways from This Article

📌  You have learned how to put cell borders inside and outside of selected cells.

📌  You got to know some shortcut keys for inserting cell borders.

📌  Gained some insights on how to add cell borders using VBA code for large datasets.


Conclusion

Adding cell borders to multiple cells is an easy task. But if you are handling huge amounts of data, you must know the techniques that can ease your work. Please leave a comment if you have any suggestions or questions. Don’t forget to visit our ExcelDen page to enhance Fyour Excel-related knowledge.

(Visited 33 times, 1 visits today)
Lamisa Musharrat

Lamisa Musharrat

Hey there! I am Lamisa Musharrat, a Marine Engineer and a Content Developer. I love to help people by writing articles for them. Hope you will enjoy my blog.

We will be happy to hear your thoughts

Leave a reply

ExcelDen
Logo