Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Beta - unprotecting multiple sheets

I have a workbook with over 40 sheets i need to unprotect
and protect from time to time. Can it be done faster than
each sheet at a time?

Thanks for your help

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default Beta - unprotecting multiple sheets

Couple of routines from JE McGimpsey


Public Sub ToggleProtect1()
'Courtesy of J E McGimpsey
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
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

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL2K & XLXP

----------------------------------------------------------------------------
Attitude - A little thing that makes a BIG difference
----------------------------------------------------------------------------



"Rick" wrote in message ...
I have a workbook with over 40 sheets i need to unprotect
and protect from time to time. Can it be done faster than
each sheet at a time?

Thanks for your help



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
Unprotecting Sheets Zee[_2_] New Users to Excel 6 November 26th 08 03:58 PM
Macro for protecting and unprotecting multiple worksheets saltnsnails Excel Discussion (Misc queries) 7 January 24th 08 10:49 PM
deleting sheets in Excel 2007 ( Beta 2 ) charles21 Excel Worksheet Functions 2 August 8th 06 05:22 PM
deleting sheets in Excel 2007 ( Beta 2 ) charles21 Excel Worksheet Functions 2 June 25th 06 02:01 AM
PROTECTING/UNPROTECTING SHEETS Maureen Excel Discussion (Misc queries) 1 January 6th 05 06:46 PM


All times are GMT +1. The time now is 05:27 AM.

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

About Us

"It's about Microsoft Excel"