ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Display worksheet protection status in a cell? (https://www.excelbanter.com/excel-worksheet-functions/68259-display-worksheet-protection-status-cell.html)

Geoff C

Display worksheet protection status in a cell?
 
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.

CLR

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.


Geoff C

Display worksheet protection status in a cell?
 
Close enough! Many thanks, Geoff.

"CLR" wrote:

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.



All times are GMT +1. The time now is 11:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com