Thread: Secure sheets
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default 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