Hello
I´m trying to achieve the possibility to hide some sheets with a password, but not all.
I found this thread:
http://www.excelforum.com/excel-prog...-password.html
Where all the sheets are hidden with a password, but since I'm not a coder, I´m not able to get some of the sheets to be hidden and some visible by default.
The workbook has this:
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
Next ws
ThisWorkbook.Save 'saves wb again without asking
End Sub
and the module:
Option Explicit
Sub PwdCheck()
Dim Pwd As String
Select Case LCase(Application.InputBox("Please enter your password", "test", 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
Hope someone can help me.
Bookmarks