1) You can't hide ALL the sheets, obviously, so let's keep Sheet1 visible. Put this in the ThisWorkbook module to accomplish that.
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Sheet1" Then ws.Visible = xlSheetVeryHidden
ThisWorkbook.Save 'saves wb again without asking
Next ws
End Sub
2) This macro can be used to prompt a user for a password to ID which sheets should be made visible
Option Explicit
Sub PwdCheck()
Dim Pwd As String
Select Case Application.InputBox("Please enter your password", "Your password", Type:=2)
Case "john"
Sheets("Sheet2").Visible = xlSheetVisible
Case "sam"
Sheets("Sheet3").Visible = xlSheetVisible
Case "admin"
Sheets("Sheet2").Visible = xlSheetVisible
Sheets("Sheet3").Visible = xlSheetVisible
End Select
End Sub
That can be attached to a button, or even reconfigured into a Workbook_Open prompt.
Bookmarks