I am using following macro to hide and show sheets for specific password. I'm wondering if I can get a "public" password that would unhide ALL sheets but in "read only mode" or "protected workbook", meaning if someone again signs in with user password, he'll be able to input data normaly.
Option Explicit
Sub PasswordChk() 'input password, unhide sheets'
Dim Pwd As String
Select Case LCase(Application.InputBox("Please enter your password to access:", "PASSWORD CONFIRMATION", Type:=2))
Case "alpha"
Sheets("Sheet1").Visible = xlSheetVisible
Sheets("Sheet2").Visible = xlSheetVisible
Sheets("Sheet3").Visible = xlSheetVisible
Case "male"
Sheets("Sheet4").Visible = xlSheetVisible
Sheets("Sheet5").Visible = xlSheetVisible
Sheets("Sheet6").Visible = xlSheetVisible
Case "one"
Sheets("Sheet7").Visible = xlSheetVisible
Sheets("Sheet8").Visible = xlSheetVisible
End Select
Sheets("MAIN").Select
Range("B1").Select
MsgBox ("Please choose process."), , "ACCESS!"
End Sub
with:
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean) 'when close, saves document, hides sheets'
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "MAIN" Then ws.Visible = xlSheetVeryHidden
Next ws
ThisWorkbook.Save 'saves wb again without asking
End Sub
Thank you for suggestions!
Bookmarks