how do i protect multiple worksheets

D

Dennis

I have a workbook with 30 sheets where I would like to protect all the sheets
at one time. I have followerd directions already posted and must be doing
something wrong because I cannot protect all sheets. I guess I need vsome
very basic help because I cannot make the codes work properly. I have entered
as posted several times so I must be missing a step.
 
D

dominicb

Good evening Dennis

If you don't want to get involved with VBA, I have a free add-in
available to anyone requesting it that will (amongst other tasks)
protect as many sheets as is necessary - with or without a password -
at once. The same sheets can also be unprotected all at once also.

If you want to use this feel free to send me an e-mail.

HTH

DominicB
[email protected]
 
G

Gord Dibben

Dennis

Don't know what you have tried so can't speak to that.

Here are a couple of macros which you would paste into a general module in the
Visual Basic Editor.

Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="justme"
Next n
Application.ScreenUpdating = True
End Sub

Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Unprotect Password:="justme"
Next n
Application.ScreenUpdating = True
End Sub

With your workbook open.............

Hit ALT + F11 to open VBEditor.

Hit CTRL + r to open Project Explorer.

Right-click on your workbook/project and hit Insert>Module

Copy and paste the code above into that module.

File>Save.

Hit ALT + q to return to Excel window.

Hit ALT + F8 to get a list of macros. The above two will be shown.

Select the ProtectAllSheets macro and "Run".

If you have a Persona Macro Workbook(Personal.xls) you may wish to have these
macros in there so's they are available for all open workbooks.

See help on "personal macros" and "create a macro".


Gord Dibben Excel MVP
 
Top