View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR
 
Posts: n/a
Default Display worksheet protection status in a cell?

Hi Geoff........
Some one (don't remember who) gave me this, some time back......it works
fine.....maybe you can use it.....

Public Sub ToggleProtectWithIndication()
'This will add "##" to the SheetName on the Tab when you unprotect the sheet,
'and remove it when you reprotect it.
Const PWORD As String = "drowssap"
Dim wkSht As Worksheet

With ActiveSheet
If .ProtectContents Then
.Unprotect Password:=PWORD
.Name = .Name & "##"
Else
.Protect Password:=PWORD
If .Name Like "*[##]" Then _
.Name = Left(.Name, Len(.Name) - 2)
End If
End With
End Sub

Vaya con Dios,
Chuck, CABGx3



"Geoff C" wrote:

My users are working with a worksheet that has protection on most of the
time, but without a password, just to help prevent accidents. It would be
nice if there was a big red cell somewhere that said "Protected" or "Not
protected". Is there a function that can display protection status? If not,
anyone have a good suggestion for achieving this effect?

Thanks,
Geoff.