Hello,
I want to use the code below but I need it to function on 3 sheets not only in one.
I tried: If Sh.Name = "Sheet1" And "Sheet2" And "Sheet3" Then, but it doesn't work, I don't think I'm doing right, if smb could help me with one.
Thank you.
Public PvSh As String
Public Pwd As String
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Pwd = "" Then
If Sh.Name = "Sheet1" Then
Num = ActiveWindow.Index
Windows(Num).Visible = False
If Application.InputBox("Enter Password", "Password") <> "12345" Then
MsgBox "Incorrect Password", vbCritical, "Error"
Application.EnableEvents = False
Sheets(PvSh).Select
Application.EnableEvents = True
Else
Pwd = "12345"
End If
Windows(Num).Visible = True
End If
End If
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
PvSh = Sh.Name
End Sub
Bookmarks