• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Turn Off ALL Gridlines

Gregg Wolin

Member
I would like to turn off the gridlines for an entire workbook and have them remain hidden regardless of how many windows get opened, closed, etc. I have seen all kinds of answers for turning them off for the ActiveWindow (but then if i open a second window the lines show up again). Can someone please tell me the best way to do this and where to put the code?
 
Gregg Wolin
++ google eg excel turn off gridlines by default
ps. Did You solve that Your previous thread?
 
Paste in ThisWorkbook module :

Code:
Option Explicit

Private Sub Workbook_Open()
  
Dim Sht As Worksheet

    For Each Sht In ActiveWorkbook.Sheets       'For all sheets in workbook
        Sht.Select                              'Select sheet
        ActiveWindow.DisplayGridlines = False   'change gridlines property to false
    Next Sht                                    'go to next sheet

End Sub
 
Paste in ThisWorkbook module :

Code:
Option Explicit

Private Sub Workbook_Open()

Dim Sht As Worksheet

    For Each Sht In ActiveWorkbook.Sheets       'For all sheets in workbook
        Sht.Select                              'Select sheet
        ActiveWindow.DisplayGridlines = False   'change gridlines property to false
    Next Sht                                    'go to next sheet

End Sub
This code works UNTIL you open a new window of the workbook (as i noted in my original post). All the worksheets in the NEW window have the gridlines visible.
 
.
Paste both in the ThisWorkbook Module :

Code:
Option Explicit

Private Sub Workbook_NewSheet(ByVal Sh As Object)
        ActiveWindow.DisplayGridlines = False   'change gridlines property to false
End Sub

Private Sub Workbook_Open()
  
Dim Sht As Worksheet

    For Each Sht In ActiveWorkbook.Sheets       'For all sheets in workbook
        Sht.Select                              'Select sheet
        ActiveWindow.DisplayGridlines = False   'change gridlines property to false
    Next Sht                                    'go to next sheet

End Sub
 
If you change the Normal style to a white fill (or any other colour) it will prevent the default grid from showing.
It can make a bit of a mess of slicer formatting though.
 
If you change the Normal style to a white fill (or any other colour) it will prevent the default grid from showing.
It can make a bit of a mess of slicer formatting though.
I actually use a dark image as a background to create a stable dark theme. Reduces the need for many cell formats.i will try your method too. Thanks for the idea.
 
Gregg Wolin
Seems that You skipped this too:
Step 22. Remove gridlines.
I did what was recommended in the journal of accountancy article but it doesn't solve the problem. The issue ONLY occurs when opening a "New Window" of a worksheet View>>New Window). I have attached an xlsx version of my standard workbook template.
 

Attachments

  • gridlines.xlsx
    135.4 KB · Views: 2
Gregg Wolin
You sent .xlsx-file for coding about eleven months later.
If You are using .xlsx-files then those won't be useful with eg marco.
I am trying to avoid using VBA. I created a new default workbook template with gridlines turned off which opens with the gridlines invisible. Its ONLY when i open a second (or third, etc) window of a workbook (any workbook) that the gridlines re-appear.
 
Gregg Wolin
Have You tried to create Template Excel-file ( .xltx-file) ?
eg this would have some hints:
... and after that You should use it.
( I didn't test or never used )
 
Gregg Wolin
Have You tried to create Template Excel-file ( .xltx-file) ?
eg this would have some hints:
... and after that You should use it.
( I didn't test or never used )
This didn't solve the problem. While worksheets based on the template have no gridlines, they reappear when I open a "New Window" of the active worksheet.
 
Gregg Wolin
So far it is a challenge ... New Window would use default settings, which could modify with
... but only Excel knows, could those gridlines set off
... without feature, which You want to avoid.

Your original question was: Can someone please tell me the best way to do this and where to put the code?
If above do not solve Your challenge and
the code ... would mean VBA ( which You try to avoid )
then
one of the best way would be to solve Your challenge is
to do it manually ( uncheck that gridlines option ). Use it as normal routine procedure.
 
Last edited:
Back
Top