ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Secure sheets (https://www.excelbanter.com/excel-programming/319809-secure-sheets.html)

Pierre[_15_]

Secure sheets
 


Hi,

How can I see on my sheets if a sheet is protected or not with a
formula?


Thanks,
Pierre

Dave Peterson[_5_]

Secure sheets
 
I don't think excel has anything you could use built in.

But you could create your own userdefined function:

Option Explicit
Function IsSheetProtected(Optional rng As Range) As Boolean

Application.Volatile True

If rng Is Nothing Then
Set rng = Application.Caller
End If

With rng.Parent
IsSheetProtected = (.ProtectContents _
Or .ProtectDrawingObjects _
Or .ProtectScenarios)
End With
End Function

But don't trust this until you recalculate. Changing the protection won't make
this function reevaluate.

In a cell:
=issheetprotected(Sheet1!A1)
or
=issheetprotected(A1)
or even
=issheetprotected()

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Pierre wrote:

Hi,

How can I see on my sheets if a sheet is protected or not with a
formula?

Thanks,
Pierre


--

Dave Peterson


All times are GMT +1. The time now is 04:26 PM.

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