Hello -
Below I have the following code that is used to password protect tab named IR before anyone can view it. Additionally, I would like for tab IR to be hidden everytime tab SR is selected. My code that attempts to do that is in red but doesn't work.
Can you please help
Public PvSh As String
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "IR" Then
Num = ActiveWindow.Index
Windows(Num).Visible = False
If (InputBox("Password?") <> "1234") Then
Windows(Num).Visible = True
Sheets(PvSh).Select
End If
Windows(Num).Visible = True
End If
If Sh.Name = "SR" Then
ActiveWorkbook.Sheets("IR").Visible = xlSheetVeryHidden
End If
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
PvSh = Sh.Name
End Sub
Moderator Note:
Pls use code tags around your code as per forum rule#3.
Bookmarks