Auto_Open Select Worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How would this Auto_Open Sub be modified to do this:

If macro security is set to “Very High†or “High,†open worksheet named
“Macro Securityâ€
Else, open on worksheet “REP003.â€

Sub Auto_open()
'This code establishes the protocol for on-screen views and features.
Dim WS As Worksheet
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
Application.EnableEvents = False

For Each WS In ThisWorkbook.Worksheets
If WS.Visible = xlSheetVisible Then
WS.Select
Application.Goto WS.Range("A1"), True
ActiveWindow.Zoom = 85
ActiveWindow.DisplayGridlines = False
ActiveWindow.DisplayWorkbookTabs = False
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayHorizontalScrollBar = False
ActiveWindow.WindowState = xlMaximized
ActiveWindow.View = xlNormalView
End If
Next

ThisWorkbook.Worksheets("REP003").Select
Application.Goto Reference:=Range("A100"), Scroll:=False
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
 
Hello
You can't!
When security is set to Very high or high your macros will be disabled.

HTH
Cordially
Pascal
 
Phil,
You need to make all sheet.visible=xlveryhidden except a splash with "You
must enable macros....."
Then in the Auto_Open, unhide the one(s) you want.
In the Auto_Close reverse the changes.

NickHK
 
Back
Top