View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How to password protect several excel workbook pages using a macro

Assume by "pages" you mean "worksheets".

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 Excel MVP

On Mon, 27 Sep 2004 21:27:02 -0700, "p88t"
wrote:

I can write a macro to protect lots of pages in a big workbook, but they are
protected without a password. How can I password protect them? I use Excel
2000.