How to Add Gridlines for Specific Cells in Excel (3 Methods)

Get FREE Advanced Excel Exercises with Solutions!

While working in Microsoft Excel, we might find files with no gridlines in the workbook. In that scenario, we might feel the need to add gridlines for some specific cells. In this article, I am going to share with you how to add gridlines for specific cells in Excel.


What are Gridlines?

Gridlines are some gray lines that are found in Excel to differentiate cells horizontally and vertically. Gridlines make it easier for a user to understand and read the data in an organized way. If a user opens a workbook and doesn’t find any gridlines in the worksheet he/she just has to go to the “View” option and check to mark the gridlines icon to get gridlines for all the cells.


How to Add Gridlines for Specific Cells in Excel (3 Quick Methods)

In the following article, I have shared 3 simple and easy methods to add gridlines for specific cells in Excel.

Suppose we have a dataset of some Employee Names and their Total Sales. But as you can see from the screenshot we don’t have any gridlines for those cells. Now we are going to add gridlines for those specific cells.

Add Gridlines for Specific Cells in Excel


1. Use Format Cells Feature to Add Gridlines for Specific Cells in Excel

Format Cells feature in Excel is a blessing as we can format any cells according to our choice. In this method, I explain how you can add gridlines for specific cells using the “Format Cells” feature.

Steps:

  • First, let’s select cells (B5:D11) as we want to add gridlines for those cells only.
  • Second, choose the “Format Cells” icon from the “Number”.

Use Format Cells Feature to Add Gridlines for Specific Cells in Excel

  • Therefore, a new window will pop up named “Format Cells”.
  • Hence, from the “Border” option press “Inside” and select all the borders.
  • In order to finish, hit the OK button to continue.

  • Finally, we have successfully added gridlines for some specific cells in Excel.

Use Format Cells Feature to Add Gridlines for Specific Cells in Excel


2. Apply Borders to Add Gridlines for Specific Cells in Excel

Sometimes you can also use the “Border” option to add gridlines for specific cells. Follow the steps below-

Steps:

  • Above all, choose some specific cells. Here I have selected cells (B5:D11).
  • Further, open the drop-down list of “Border” from the home ribbon.

Apply Borders to Add Gridlines for Specific Cells in Excel

  • Then, choose “All Borders” from the list.

  • In conclusion, you will find gridlines for all the specific cells you selected.

Apply Borders to Add Gridlines for Specific Cells in Excel

Read More: How to Add More Gridlines in Excel


3. Excel VBA to Add Gridlines for Specific Cells

You can apply a VBA code and add gridlines for cells. Below I have shared the steps-

Steps:

  • While the workbook is opened press Alt+F11.

Excel VBA to Add Gridlines for Specific Cells

  • Therefore, a new dialog box will open named “Microsoft Visual Basic for Applications”.
  • Hence, press “Module” from the “Insert” option.

  • In the new module put the following code and click “Run” to run the code-
Sub Add_Gridline()
Dim rng As Long
rng = Range("B" & Rows.Count).End(xlUp).Row
Range("B5:D" & rng).Borders.Weight = xlThin
End Sub

Excel VBA to Add Gridlines for Specific Cells

  • Finally, you will get gridlines for all the specific cells in Excel.

Excel VBA to Add Gridlines for Specific Cells


Things to Remember

  • You can press Alt+1 to open the “Format Cells” dialog box.

Download Practice Workbook

Download this practice workbook to exercise while you are reading this article.


Conclusion

In this article, I have tried to cover all the methods to add gridlines for specific cells in Excel. Take a tour of the practice workbook and download the file to practice by yourself. I hope you find it helpful. Please inform us in the comment section about your experience. We, the Exceldemy team, are always responsive to your queries. Stay tuned and keep learning.


Related Articles

Wasim Akram
Wasim Akram

Hi! my name is Wasim Akram. I am a graduate in mechanical engineering from Ahsanullah University of Science & Technology. I am passionate about learning new things and writing articles. I write article about Microsoft Excel and it's my favourite thing to do.

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo