Excel

Hide the Gridlines

Ease of Use

Easy

Version tested with

2000, 2003 

Submitted by:

johnske

Description:

On activating a sheet the gridlines become invisible. 

Discussion:

You may often prefer to hide the unsightly gridlines and just view the worksheet exactly as it will appear when it's printed. This is particularly so when you have created a something (such as an invoice/receipt) that you may want to appear as if it's a text document... You can go to Tools/Options and untick Window Options/Gridlines to do this, but this can be time-consuming if you do this regularly, it's much simpler just to paste this code in your ThisWorkbook module and have it done automatically... 

Code:

instructions for use

			

Option Explicit Private Sub Workbook_SheetActivate(ByVal Sh As Object) ActiveWindow.DisplayGridlines = False End Sub

How to use:

  1. Open an Excel workbook
  2. Select Tools/Macro/Visual Basic Editor
  3. In the VBE window, select Tools/Project Explorer
  4. Select the ThisWorkbook module
  5. Copy and paste the code into the Module
  6. Now select File/Close and Return To Microsoft Excel
  7. Save your changes...
 

Test the code:

  1. Click a worksheet tab and watch the gridlines disappear.
 

Sample File:

HideGridlines.zip 6.03KB 

Approved by mdmackillop


This entry has been viewed 176 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express