Ken
Wed Jun 02 13:58:57 CDT 2004
The following courtesy of JE will toggle protection on every sheet, so if you
only want certain ones protected then do those manually initially, and then use
this to turn protection on/off. It will give you a status of every sheet once
done.
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
--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03
----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------
"Steve Klenner" <steve_klenner@bsbcom.com> wrote in message
news:%232sXCbLSEHA.3988@tk2msftngp13.phx.gbl...
> Is there a way to visually see if a worksheet is protected? The toolbar
> will indicate protected cells but I cannot find a way to indicate whether a
> worksheet is protect without manually checking.
>
> Is there a formula that can be used in conditional formating of a cell that
> could indicate if a worksheet is protected or not. I need a quick way to
> know that required worksheets are protected.
>
> Thanks
> Steve
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.692 / Virus Database: 453 - Release Date: 28/05/2004