I am trying to get this code to work so that the MySheet = "XXXXXX" is locked from view unless a password is entered. It works fine when I have only one MySheet listed, but when I enter another MySheet only the one date 05.14.17 is now password protected. What am I missing? Thanks!!
Private Sub Workbook_SheetA ctivate(ByVal Sh As Object)
' Keyboard Shortcut: Ctrl+Shift+O
Dim MySheets As String, Response As String
MySheet = "05.07.17"
MySheet = "05.14.17"
If ActiveSheet.Nam e = MySheet Then
ActiveSheet.Vis ible = False
Response = InputBox("Enter password to view sheet")
If Response = "payroll" Then
Sheets(MySheet) .Visible = True
Application.Ena bleEvents = False
Sheets(MySheet) .Select
Application.Ena bleEvents = True
End If
End If
Sheets(MySheet) .Visible = True
End Sub
Private Sub Workbook_Open()
'
'On open the Project List worksheet is selected.
'
Worksheets("Pro ject List").Select
'
End Sub
Private Sub Workbook_SheetA ctivate(ByVal Sh As Object)
' Keyboard Shortcut: Ctrl+Shift+O
Dim MySheets As String, Response As String
MySheet = "05.07.17"
MySheet = "05.14.17"
If ActiveSheet.Nam e = MySheet Then
ActiveSheet.Vis ible = False
Response = InputBox("Enter password to view sheet")
If Response = "payroll" Then
Sheets(MySheet) .Visible = True
Application.Ena bleEvents = False
Sheets(MySheet) .Select
Application.Ena bleEvents = True
End If
End If
Sheets(MySheet) .Visible = True
End Sub
Private Sub Workbook_Open()
'
'On open the Project List worksheet is selected.
'
Worksheets("Pro ject List").Select
'
End Sub