View Single Post
  #2   Report Post  
Gord Dibben
 
Posts: n/a
Default how do i protect multiple worksheets

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 InsertModule

Copy and paste the code above into that module.

FileSave.

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

On Mon, 31 Oct 2005 14:58:02 -0800, Dennis
wrote:

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.