Secure sheets

  • Thread starter Thread starter Pierre
  • Start date Start date
P

Pierre

Hi,

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


Thanks,
Pierre
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top