7 Ways to Add or Remove Gridlines in Microsoft Excel

This post is going to show you all the different methods you can use to add or remove the gridlines in your Excel workbooks.

Excel has gridlines in each sheet or your workbook. These are the light gray lines that outline each cell in the sheet.

Gridlines can help you distinguish between the rows, columns, and any data they contain. But maybe you don’t want to see the gridlines in your final report or dashboard. In this case, you will want to hide these gridlines.

Removing the gridlines is very easy and it can be done in many ways.

Download a copy of the example workbook used in this post and follow along to discover all the ways you can show or hide the gridlines in your Excel workbooks.

Add or Remove Gridlines from the View Tab

Removing the gridlines is such a common task that it has been included as a command in the Excel ribbon View tab.

This is the most straightforward method for toggling on or off the gridlines.

Follow these steps to toggle on or off the gridlines from the View tab.

  1. Go to the View tab.
  2. Click on the Gridlines option in the Show section.

This will remove the Gridlines from the active sheet when you uncheck the Gridlines option.

Add or Remove Gridlines from the Excel Options Menu

The Excel Options menu is where you will find a ton of useful app and workbook settings to enhance your Excel experience, and you can also find the gridline settings here.

Follow these steps to add or remove the gridlines from the Excel Options menu.

  1. Go to the File tab.
  1. Select Options in the lower left of the backstage screen.

This will open the Excel Options menu.

  1. Go to the Advanced section of the Excel Options menu.
  2. Scroll down to the Display options for this worksheet section and select the sheet in the dropdown from which you want remove the gridlines.
  3. Press the Show gridlines option. Uncheck this to remove the gridlines from the sheet.
  4. Press the OK button to close the Excel Options menu.

This will remove the gridlines from your sheet!

Add or Remove Gridlines with a Keyboard Shortcut

There is no dedicated keyboard shortcut to add or remove the gridlines in Excel, but you can use the Alt hotkeys.

When you press the Alt key, this will activate the hotkeys and the Excel ribbon will display what keys you need to press in order to navigate the ribbon commands.

Press the Alt, W, V, G sequence on your keyboard to toggle on or off the gridlines with a keyboard shortcut.

Add or Remove Gridlines from the Quick Access Toolbar

One way to make removing the gridline very easy is to add this command to your Quick Access Toolbar.

This way it is always accessible with one click.

Follow these steps to add the gridline command to your quick access toolbar.

  1. Go to the View tab.
  2. Right-click on the Gridline option.
  3. Select the Add to Quick Access Toolbar option from the menu.

Now the command will be available in your Quick Access Toolbar!

💡 Tip: The Alt hotkeys are an easy way to use the commands in your Quick Access Toolbar! In this example, the Gridlines command is the 4th item in the QAT so you can press Alt + 4 to access it.

Add or Remove Gridlines when Printing

If you want to print your Excel reports, the gridlines don’t appear in the printed results by default.

However, you may want the gridlines to appear and it is possible to have them show in the printouts.

Follow these steps to add or remove the gridlines to your Excel printouts.

  1. Go to the File tab.
  2. Go to the Print options.
  3. Click on the Page Setup link at the bottom of the printing options.

This will open the Page Setup menu.

  1. Go to the Sheet tab in the Page Setup menu.
  2. Check the Gridlines options under the Print section.
  3. Press the OK button.

Now your printouts will show the gridlines!

Add or Remove Gridlines from All Sheets with VBA

The methods you have seen so far for removing gridlines have one major issue. If you want to remove gridlines from all the sheets in your workbook, you will have to change the gridline setting for each sheet individually.

This can be a very tedious process when you have a lot of sheets in your workbook.

You can use a VBA script to automate this process and remove the gridlines from all the sheets at once.

Go to the Developer tab and click on the Visual Basic command to open the visual basic editor.

If you don’t find this tab in your ribbon, you can easily add the Developer tab to your ribbon. You can also press Alt + F11 on your keyboard to open the editor.

Go to the Insert menu and select the Module option to create a new module. This is where you can add the VBA code that will remove the gridlines in all the sheets of the workbook.

Sub removeGridlines()
    Dim sheet As Worksheet
    Dim sheetGridStatus As Boolean
    sheetGridStatus = ActiveWindow.DisplayGridlines
    For Each sheet In Worksheets
        sheet.Activate
        ActiveWindow.DisplayGridlines = Not (sheetGridStatus)
    Next sheet
End Sub

Select the new module and then paste in the above code.

This code will loop through all the sheets and toggle on or off the gridlines depending on the gridline status of the sheet in view when you run the macro.

This is a quick way to toggle gridlines for all the sheets!

Add or Remove Gridlines from All Sheets with Office Scripts

There is another option for automating the removal of the gridlines from all your sheets.

If you are using Excel online with a business plan, then you will have access to Office Scripts. This is a JavaScript language that can be run for Excel on the web!

You can create an Office Script to toggle on or off the gridlines from your entire workbook.

Go to the Automate tab in Excel online and select the New Script command.

function main(workbook: ExcelScript.Workbook) {
	let sheets = workbook.getWorksheets();
	let selectedSheet = workbook.getActiveWorksheet();
	let selectedSheetStatus = selectedSheet.getShowGridlines();

	for (let sheet of sheets) {
		sheet.setShowGridlines(!selectedSheetStatus);
	}
}

This will open the Office Script editor and you can copy and paste the above code into the editor.

This code will loop through all the sheets in the workbook and toggle on or off the gridlines based on the gridline status of the current sheet.

Press the Run button in the editor to run this code and easily switch between showing or hiding the gridlines while using Excel on the web.

Conclusions

By default, light gray lines separate each cell in your workbook, but you can remove these lines for a much cleaner look to your Excel reports and dashboards.

The gridline settings can be found in either the View tab or the Excel Options menu and these will toggle on or off the gridlines on a per sheet basis.

When printing your Excel reports, it is also possible to include the gridlines if needed.

You can also use VBA or Office Scripts to automate the process of removing gridlines in all your sheets. This is essential when you have a workbook with many sheets.

Do you like the default gridlines or do you prefer to remove than from your workbooks? Do you know any other ways to get this done? Let me know in the comments section below!

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and qualified actuary with over 15 years of experience. He has worked in a variety of industries, including insurance, ad tech, and most recently Power Platform consulting. He is a keen problem solver and has a passion for using technology to make businesses more efficient.

Subscribe

Subscribe for awesome Microsoft Excel videos 😃

John MacDougall

I’m John, and my goal is to help you Excel!

You’ll find a ton of awesome tips, tricks, tutorials, and templates here to help you save time and effort in your work.

Related Posts

Comments

0 Comments

Get the Latest Microsoft Excel Tips

Follow Us

Follow us to stay up to date with the latest in Microsoft Excel!

Subscribe for awesome Microsoft Excel videos 😃