ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   How to set password for multiple worksheet and to hide ? (https://www.excelbanter.com/new-users-excel/190924-how-set-password-multiple-worksheet-hide.html)

Mah

How to set password for multiple worksheet and to hide ?
 
How am I to set different password for different worksheet ? This to allow
certain person to see only certain worksheet when clicking on one password
"123". I'm new Macro. Your guidance please


Robert McCurdy

How to set password for multiple worksheet and to hide ?
 
Ok, you are going to write down all your passwords first?

Sub ProtectAllSheets()
Dim wks As Worksheet, Pswd As String
Pswd = "mypassword" 'change to your one
For Each wks In ActiveWorkbook.Worksheets
wks.Protect Password:=Pswd & wks.Index
Next wks
End Sub

To Unprotect:

Sub UnProtectAllSheets()
Dim wks As Worksheet, Pswd As String
Pswd = "mypassword" 'use your password
For Each wks In ActiveWorkbook.Worksheets
wks.Unprotect Password:=Pswd & wks.Index
Next wks
End Sub


Paste these 2 into a new code module (Alt + F11 and insert module)
Then to run them Alt + F8 will show them, under Options there you can create a short cut key combination.

Regards
Robert McCurdy
"Mah" wrote in message ...
How am I to set different password for different worksheet ? This to allow
certain person to see only certain worksheet when clicking on one password
"123". I'm new Macro. Your guidance please



All times are GMT +1. The time now is 01:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com