View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
wally
 
Posts: n/a
Default Sheet Protection

Ken, sorry I took so long in getting back. I can't get the macro to
work. Iv'e tried more than several times. Any suggestions?
Wally
Ken Johnson wrote:
Hi Wally,

The following macros worked for me...

To protect some sheets first use Shift-Click Tab to group those sheets
then run the following macro...

Public Sub ProtectSelectedSheets()
Dim Sht As Worksheet
Dim ncProtect As New Collection
For Each Sht In ActiveWindow.SelectedSheets
ncProtect.Add Item:=Sht
Next Sht
Worksheets(1).Select
For Each Sht In ncProtect
Sht.Protect
Next Sht
End Sub

To Unprotect some protected sheets first use Shift-Click Tab to group
those sheets then run the following macro...

Public Sub UnprotectSelectedSheets()
Dim Sht As Worksheet
Dim ncUnprotect As New Collection
For Each Sht In ActiveWindow.SelectedSheets
ncUnprotect.Add Item:=Sht
Next Sht
Worksheets(1).Select
For Each Sht In ncUnprotect
Sht.Unprotect
Next Sht
End Sub

I have assumed that you have NOT used passwords to protect your sheets.

Ken Johnson