Dear Experts,
please amend the following code to turn off the Workbook & Worksheet protections while the following code runs & turn on protection again at the end.
Workbook password "xyz" worksheet password "xyz"
------------------------------------------------------------------------------------------
Sub Button1_Click()
Dim Pass As String
Pass = InputBoxDK("Please enter your password", "Hide Sheets")
If Pass = "123" Then
If Worksheets("a").Visible = True Then
Sheets(Array("a", "b", "c", "d")).Visible = False
Else
Sheets("a").Visible = True
Sheets("b").Visible = True
Sheets("c").Visible = True
Sheets("d").Visible = True
End If
Else
MsgBox "Incorrect password", vbCritical, "Invalid Password"
End If
End Sub
--------------------------------------------------------------------------------------------------
Thanks for your efforts.
S h a n
Bookmarks