Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Un-protect Multiple Worksheets

I have a large workbook that contains approx. 80 worksheets. I have each
sheet protected individually with the same password.
Can anyone tell me if there is a way to unprotect all sheets at one time so
that changes can be made quicker and easier.
I tend to spend more time un-protecting and re-protecting the sheets due to
the multitude of sheets.
Thanks
Ed
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default Un-protect Multiple Worksheets

Take your pick. All either courtesy of JE or based on his routine.

Public Sub ToggleProtect1()
'Courtesy of J E McGimpsey
'If only selected sheets are to be protected, then a toggle works well

Const PWORD As String = "ken"
Dim wkSht As Worksheet
Dim statStr As String

For Each wkSht In ActiveWorkbook.Worksheets
With wkSht
statStr = statStr & vbNewLine & "Sheet " & .Name
If .ProtectContents Then
wkSht.Unprotect Password:=PWORD
statStr = statStr & ": Unprotected"
Else
wkSht.Protect Password:=PWORD
statStr = statStr & ": Protected"
End If
End With
Next wkSht
MsgBox Mid(statStr, 2)
End Sub

-----------------------------------------

Sub Toggleprotect2()
'Courtesy of J E McGimpsey
'If only selected sheets are to be protected, then a toggle works well

Const PWORD As String = "ken"
Dim wkSht As Worksheet

For Each sh In ActiveWorkbook.Worksheets
If sh.ProtectContents = False Then
sh.Protect PWORD
Else
sh.Unprotect PWORD
End If
Next sh
End Sub

-----------------------------------------

Public Sub ProtectAllSheets()
'Space allowed for insertion of a password
'Code lists every sheet with it's protection status
Application.ScreenUpdating = False
Const PWORD As String = ""
Dim wkSht As Worksheet
Dim statStr As String

For Each wkSht In ActiveWorkbook.Worksheets
With wkSht
statStr = statStr & vbNewLine & "Sheet " & .Name
wkSht.Protect Password:=PWORD
statStr = statStr & ": Protected"
End With
Next wkSht
MsgBox Mid(statStr, 2)
Application.ScreenUpdating = True
End Sub

-----------------------------------------

Public Sub UnprotectAllSheets()
'Space allowed for insertion of a password
'Code lists every sheet with it's protection status
Application.ScreenUpdating = False
Const PWORD As String = ""
Dim wkSht As Worksheet
Dim statStr As String

For Each wkSht In ActiveWorkbook.Worksheets
With wkSht
statStr = statStr & vbNewLine & "Sheet " & .Name
wkSht.Unprotect Password:=PWORD
statStr = statStr & ": Unprotected"
End With
Next wkSht
MsgBox Mid(statStr, 2)
Application.ScreenUpdating = True
End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Ed P" wrote in message
...
I have a large workbook that contains approx. 80 worksheets. I have each
sheet protected individually with the same password.
Can anyone tell me if there is a way to unprotect all sheets at one time

so
that changes can be made quicker and easier.
I tend to spend more time un-protecting and re-protecting the sheets due

to
the multitude of sheets.
Thanks
Ed



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect/Unprotect Multiple Worksheets Katherine R Excel Discussion (Misc queries) 2 May 9th 06 04:07 PM
protect multiple worksheets adey v. Excel Discussion (Misc queries) 1 November 5th 05 01:47 AM
how do i protect multiple worksheets Dennis Excel Discussion (Misc queries) 2 October 31st 05 11:41 PM
Protect multiple worksheets Cas Excel Discussion (Misc queries) 3 June 24th 05 03:39 PM
Protect multiple worksheets Cas New Users to Excel 3 June 24th 05 03:39 PM


All times are GMT +1. The time now is 03:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"