View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Protection Macro


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


Gord Dibben MS Excel MVP

On Mon, 4 Feb 2008 14:02:00 -0800, santaviga
wrote:

Hello.

I'm looking for a macro to run to protect all worksheets in a workbook, I
have about 50 worksheets and its a lot of work going through the protection
menu for every worksheet, Can someone give me a macro to run so when run it
protects all worksheets in the workbook and also one to run to unprotect all
worksheets in a workbook.

many Thanks