By default, light gray colored gridlines are visible in the worksheet area in the Excel file.
These gridlines are like a border around each cell that shows you the outline of the cell.
In most cases, Excel users are okay with having the gridlines visible in the worksheet. But in many cases, removing these gridlines is required (as it makes your worksheet look cleaner).
In this short tutorial, I will show you how to remove gridlines in Excel quickly. You can do this using the option in the ribbon, or a keyboard shortcut that I’ll cover in this tutorial.
Remove Gridlines in Excel Using the View Tab
Below are the steps to remove the gridlines from the worksheet in Excel:
- Click the View tab
- In the Show group, uncheck the ‘Gridlines’ option
The above steps would instantly remove the gridlines from the active worksheet.
And if you need to get the gridlines back again, follow the same steps and check the ‘Gridlines’ option in Step 2.
The same steps are also valid if you’re using a Mac.
Note that when you use this method to remove the gridlines, it’s only removed from the active sheet. All the other sheets in your workbook would not be impacted.
Also, this would not impact any new sheet that you insert in the workbook (which would continue to have the gridlines as it’s the default setting).
Shortcut to Remove Gridlines in Excel
Below is the keyboard shortcut you can use in windows to quickly remove the gridlines in Excel:
ALT + W + V + G
Press the keys in succession (one after the other).
Also read: How to Create Barcodes in Excel
Remove Gridlines from All the Worksheets in One Go
As I mentioned earlier, when you remove the gridlines using the keyboard shortcut (or using the option in the View tab), it only removes the gridlines in the active sheet.
But what if you want to remove the gridlines from all the sheets in the workbook?
Here are two ways to do that.
Selecting all Worksheets
When you select more than one worksheet, they get grouped together and any action that you take on the active worksheet would also be done on all the remaining selected sheets.
Below are the steps to remove the gridlines from all the sheets in one go:
- Select all the sheets from which you want to remove the gridlines. To do this, hold the Control key and then select all the sheet tabs (or hold the shift key and select the first and the last sheet tab)
- Click the ‘View’ tab
- Uncheck the ‘Gridlines’ option
- [VERY IMPORTANT] Right-click on any of the sheet tabs and then click on ‘Ungroup Sheets’
Note that it is really important that you follow Step 4 – which would ungroup all the sheets that have been grouped in step 1. If you don’t do this, anything that you do on the active sheet would also be done for all the other worksheets (since these are now grouped).
While the previous method works well, it could be quite messy if you have a lot of worksheets from which you want to remove the gridlines.
Also, a lot of people forget to ungroup the worksheets which can create havoc.
So let me show you a simple VBA code that can quickly cycle through all your worksheets and remove the gridlines in less than a second.
Below is the VBA code that would go through each worksheet and then remove the gridlines.
It would then return back to the original worksheet that was activated while running the code.
'Code developed by Steve Scott from https://spreadsheetplanet.com Sub Remove_Gridlines() Dim CurrentSheet As Worksheet Set CurrentSheet = ActiveSheet For Each sh In Sheets sh.Activate ActiveWindow.DisplayGridlines = True Next sh CurrentSheet.Activate End Sub
Where to Place this VBA code to Remove Gridlines?
Below are the steps to place this VBA code in the VBA editor in Excel so that you can run it:
- Click the Developer Tab (if you don’t see the developer tab, click here to see how to get it)
- Click on the Visual Basic icon
- [OPTIONAL] If you don’t see the ‘Project Explorer’, click on the View option in the menu and then click on ‘Project Explorer’
- Select any object in the workbook in which you want to put this code (you will see these objects in the ‘Project Explorer’ section)
- Click the ‘Insert’ option in the menu
- Click on ‘Module’ – this will insert a new module
- Double-click on the Module that is inserted in the Project Explorer
- Copy and paste the above code into the Module code window
To run the VBA code, select any line in the code and then click on the green run icon in the toolbar in the VB editor.
If you need to use this code quite often to remove the gridlines from the entire workbook, it would be better to save this code in the Personal Macro Workbook. Any code that is saved in the Personal Macro Workbook becomes available for all the Excel Workbooks on your system.
Also read: How to Remove Borders in Excel? 6 Easy Ways!
Change the Default Color of the Gridlines (Darken/Lighten the Gridlines)
Many people do not like the light gray color of the gridlines and wonder if the color could be changed to something else (maybe a bit darker).
Thankfully, this can be done.
Below are the steps to change the default color of the gridlines in Excel:
- Click the File tab
- Click on Options
- In the Excel Options dialog box, click on the Advanced category
- Scroll down to the ‘Display Options for this worksheet’ option
- Select the Gridline color you want
While this works well, one limitation of this method is that it will only change the gridlines in the active sheet.
If you want to change the gridlines color of all the sheets, you would first have to select all the sheets (which would group them), and then follow the above steps.
Also, remember to ungroup the sheets once you’re done.
This would also not change the gridline color of any new Excel workbook that you create.
Change Gridlines Color Using VBA
Below is the VBA code that would change the gridline color of all the worksheets in your workbook.
Sub Change_Gridlines_Colors() Dim CurrentSheet As Worksheet Set CurrentSheet = ActiveSheet For Each sh In Sheets sh.Activate ActiveWindow.GridlineColor = vbBlue Next sh CurrentSheet.Activate End Sub
Note that I have specified the color as vbblue in step 6. You can change this to any color you want. You can either use VBA inbuilt color commands (such as vbRed or vbGreen, or the RGB notation)
Can you Remove Gridlines from Some Parts of the Worksheet, But Keep Them in the Rest?
When you remove gridlines in Excel, it would be removed from the entire worksheet. You cannot selectively keep the gridlines in some parts of the worksheet and remove them from the rest.
However, a workaround is to remove the gridlines from the entire worksheet and then use the borders option to apply borders to the cells where you want to show a grid.
So these are the methods you can use to remove gridlines in Excel. I’ve also covered how to remove gridlines from all the worksheets in one go using the worksheet grouping method or VBA
I hope you found this Excel article useful.
Other Excel tutorials you may also like:
- How to Print Gridlines in Excel
- How to Add Gridlines in a Chart in Excel?
- How to Remove Dotted Lines in Excel
- How to Remove Page Breaks in Excel?
- How to Remove Panes in Excel Worksheet (Shortcut)
- Indent in Excel (Shortcut)
- How to Change Theme Colors in Excel?
- How to Remove Conditional Formatting in Excel?
- How to Remove Watermark in Excel (Image and Text)?