macros to hide sheet with protection
Bakar,
Copy this to a new module, then add a button to sheet1 that links to the "ReHide" macro and a button to sheet2 that links to the "UnHide" macro. You set your password with the very first line of the module, so you may want to password protect the module as well. Here is the code:
Const pWord As String = "Hello123"
Sub UnHide()
If InputBox("Please enter password to open worksheet", "Password?", _
"Enter Password") = pWord Then
Sheet1.Visible = xlSheetVisible
Sheet1.Activate
End If
End Sub
Sub ReHide()
Sheet1.Visible = xlSheetVeryHidden
End Sub
|