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.
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.
- 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”.
- 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.
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-
- 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.
- Then, choose “All Borders” from the list.
- In conclusion, you will find gridlines for all the specific cells you selected.
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-
- While the workbook is opened press Alt+F11.
- 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
- Finally, you will get gridlines for all the specific cells in Excel.
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.
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.