P Pierre Dec 30, 2004 #1 Hi, How can I see on my sheets if a sheet is protected or not with a formula? Thanks, Pierre
D Dave Peterson Dec 30, 2004 #2 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
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