Excel VBA - When creating a new window (so there are multiple windows), make new window  DisplayGridlines=False

AndresHernando
AndresHernando used Ask the Experts™
on
In the View tab of the ribbon I create a New Window.  This window opens with "show gridlines" selected by default.

How can I make the new window  DisplayGridlines=False?

I tried this code in the worksheet VBA page but it doesn't execute since the worksheet is already selected when I create the new window.


Private Sub Worksheet_Activate()

       ActiveWindow.DisplayGridlines = False
   
End Sub
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2012

Commented:
What you want is the WINDOW activate event

e.g.,

Private Sub Workbook_WindowActivate

Dave
Most Valuable Expert 2012
Top Expert 2012
Commented:
Put this code in your "ThisWorkbook" codepage:

Private Sub Workbook_WindowActivate(ByVal Wn As Window)

    Wn.DisplayGridlines = False

End Sub


Dave

Author

Commented:
Perfect!   -Thanks!!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial