by Allen Wyatt
(last updated April 14, 2018)
When Kenneth prints a worksheet, 99% of the time he prefers printing it with gridlines. However, the gridlines check box (on the Sheet tab of the Page Setup dialog box) is not selected by default. Kenneth wonders if there is a way to change this setting so that it is always selected.
There are actually a couple of different ways you can approach this task. If you want all of your future workbooks or worksheets to have the gridlines turned on by default, start by create a default workbook and worksheet that Excel will rely on when creating these. How you do this has been covered in other ExcelTips, such as this one:
Note that this approach affects all newly created worksheets or workbooks; it doesn't affect any that were previously created. If you want to affect those, you might want to consider a simple macro to turn on the gridlines. This could be assigned to either a shortcut key or to the Quick Access Toolbar. Here's an example of one that turns on the gridlines:
Sub GridlinesOn() ActiveSheet.PageSetup.PrintGridlines = True End Sub
That's it—a single line. You can, if desired, also get fancier with the macro so that it toggles the gridlines and displays their state. Here's an example:
Sub GridlinesToggle() Dim sStatus As String sStatus = "OFF" With ActiveSheet.PageSetup .PrintGridlines = Not .PrintGridlines If .PrintGridlines Then sStatus = "ON" End With Msgbox "The gridlines are now " & sStatus End Sub
Finally, you could also create a macro that makes sure the gridlines are turned on and then prints the current worksheet. This requires adding a single line to the earlier macro that turned on the gridlines:
Sub PrintGridlines() ActiveSheet.PageSetup.PrintGridlines = True ActiveSheet.PrintOut End Sub
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13515) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365.
Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!
Need to only print out certain rows from your data? It's easy to do if you apply the filtering or sorting techniques ...Discover More
Need to print just a portion of a worksheet? It's easy to do if you follow the steps in this tip.Discover More
Need to print just a few pages from a group of worksheets? The easiest way to handle the task may be through a macro, as ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.