Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unprotecting Sheets | New Users to Excel | |||
Macro for protecting and unprotecting multiple worksheets | Excel Discussion (Misc queries) | |||
deleting sheets in Excel 2007 ( Beta 2 ) | Excel Worksheet Functions | |||
deleting sheets in Excel 2007 ( Beta 2 ) | Excel Worksheet Functions | |||
PROTECTING/UNPROTECTING SHEETS | Excel Discussion (Misc queries) |