mshbhwn98
02-28-2013, 10:05 AM
Hi,
I have 2 sub routines that remove the gridlines, headings and make excel full screen. Is there a way to allow me to open another excel spreadsheet ie file new without it looping through the code below?
So what I am seeing is when I click file new it flicks through the worksheets of my open workbook and won't let me see the other workbook that I just tried to create. It is there but I can't get to it.
The second sub routine undoes all the changes I made to set excel back to its previous settings.
Private Sub Workbook_Activate()
Dim ws As Worksheet
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
Set wbBook = ThisWorkbook
For Each wsSheet In wbBook.Worksheets
If Not wsSheet.Name = "Blank" Then
wsSheet.Activate
With ActiveWindow
.DisplayHeadings = False
.DisplayGridlines = False
'.DisplayWorkbookTabs = True
'.DisplayHorizontalScrollBar = False
End With
End If
Next wsSheet
Sheets("Summary").Activate
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_Deactivate()
Dim ws As Worksheet
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayFullScreen = False
Set wbBook = ThisWorkbook
For Each wsSheet In wbBook.Worksheets
If Not wsSheet.Name = "Blank" Then
wsSheet.Activate
With ActiveWindow
.DisplayHeadings = True
.DisplayGridlines = True
'.DisplayWorkbookTabs = True
'.DisplayHorizontalScrollBar = False
End With
End If
Next wsSheet
Sheets("Summary").Activate
Application.ScreenUpdating = True
End Sub
I have 2 sub routines that remove the gridlines, headings and make excel full screen. Is there a way to allow me to open another excel spreadsheet ie file new without it looping through the code below?
So what I am seeing is when I click file new it flicks through the worksheets of my open workbook and won't let me see the other workbook that I just tried to create. It is there but I can't get to it.
The second sub routine undoes all the changes I made to set excel back to its previous settings.
Private Sub Workbook_Activate()
Dim ws As Worksheet
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
Set wbBook = ThisWorkbook
For Each wsSheet In wbBook.Worksheets
If Not wsSheet.Name = "Blank" Then
wsSheet.Activate
With ActiveWindow
.DisplayHeadings = False
.DisplayGridlines = False
'.DisplayWorkbookTabs = True
'.DisplayHorizontalScrollBar = False
End With
End If
Next wsSheet
Sheets("Summary").Activate
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_Deactivate()
Dim ws As Worksheet
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayFullScreen = False
Set wbBook = ThisWorkbook
For Each wsSheet In wbBook.Worksheets
If Not wsSheet.Name = "Blank" Then
wsSheet.Activate
With ActiveWindow
.DisplayHeadings = True
.DisplayGridlines = True
'.DisplayWorkbookTabs = True
'.DisplayHorizontalScrollBar = False
End With
End If
Next wsSheet
Sheets("Summary").Activate
Application.ScreenUpdating = True
End Sub