Turn Gridlines on/off

JasonP

New Member
Joined
Jun 21, 2006
Messages
16
Hello

Is there a button in Excel you can press that will turn gridlines on/off rather than going through the tools/options/gridlines route?

Regards

Jason
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

you could write a macro and assign it to a shortcutkey
Code:
Sub toggle_gridlines()
    ActiveWindow.DisplayGridlines = Not ActiveWindow.DisplayGridlines
End Sub
kind regards,
Erik
 

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,

alternatively, use the predefined button (Look in FORMS - TOGGLE GRID) and move this to a toolbar.
 

JasonP

New Member
Joined
Jun 21, 2006
Messages
16
Hello

Thanks for that it's great. Is there any way to use that process to add a button to a toolbar so that you can turn the gridlines on/off in any worksheet/workbook?

Regards

Jason
 

JasonP

New Member
Joined
Jun 21, 2006
Messages
16

ADVERTISEMENT

Hello

Ignore my last post, have found the Toggle Grid button as suggested by onlyadrafter

Thanks a lot

Regards

Jason
 

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,

If you're replying to me, you need to select VIEW --> TOOLBARS --> Customize, from the Commands tab, select FORMS, in the window under Commands: scroll down until you see Toggle Grid. Select this with the mouse and drag it into one of the existing toolbars.

When you restart Excel again, it should be there.
 

Coldwall

New Member
Joined
Jul 12, 2014
Messages
1
Erik,

The Active Window only works for that sheet. I want to turn the gridlines off in specific tabs. For example I have 14 tabs and I want to write some VBA that when run turns off the gridlines in say 7 of them. Is this possible ?

Thanks
Shane


Hi,

you could write a macro and assign it to a shortcutkey
Code:
Sub toggle_gridlines()
    ActiveWindow.DisplayGridlines = Not ActiveWindow.DisplayGridlines
End Sub
kind regards,
Erik
 

Forum statistics

Threads
1,136,928
Messages
5,678,623
Members
419,776
Latest member
mikelowski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top