Auto_Open Select Worksheet

P

Phil H

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
 
P

papou

Hello
You can't!
When security is set to Very high or high your macros will be disabled.

HTH
Cordially
Pascal
 
N

NickHK

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top