applying mutiple passwords from a list

jiddings

Board Regular
Joined
Nov 22, 2008
Messages
135
I have mutiple worksheets in one one workbook that is accessed by numerous individuals.
I have a separate file maintaining the worksheet names (in column "A") and the corresponding individual passwords to each sheet (in column "B"). My intent is to loop through the listing and set the passwords for each worksheet. When I add a worksheet or change the password for another worksheet, I would like to use the listing to reset or add the password to the corresponding worksheets.
I would appreciate any help on how I could do this.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Yes, my thoughts are to use VBA. However, I'm unsure how to assemble the correct code to do what I need.
 
Upvote 0
i dont know if you can using cells , but i will try that, but you can do it using VBA code with the passwords in the VBA code

here is one way in code.

Code:
Dim S As Object
  For Each S In Sheets
  'unprotect the sheets first
  S.Unprotect password:="password"
  'protect the sheets and any objects on the sheet
  S.Protect password:="password", DrawingObjects:=True
 Next
End Sub

or like this
Code:
Sub ProtectSheet()
 ActiveSheet.Protect password:="Mypass"
End Sub
 
Sub UnProtectSheet()
 ActiveSheet.Unprotect password:="Mypass"
End Sub
 
Upvote 0
Thanks,
I have approx. 30 worksheets in one workbook (with probably more to be added), each with a different password. The listing of sheet names and passwords are kept in a separate workbook file to maintain the password protected worksheets. Obviously, it is very time consuming, to manually update the password(s) when several passwords change or several more worksheets are added.
If you know of a way to loop (by VBA) through worksheet names & apply associated passwords to the worksheets, it would be very helpful.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top