Check if a worksheet is protected

chris115

New Member
Joined
Sep 29, 2006
Messages
9
Hi

How do can I check if a workbook is already protected?

I think it should be something like this but not too sure.

If ActiveWorkbook.Protection = True Then
MsgBox ("Please unlock the workbook first")
Exit Sub
Else....

Thanks in advance
 

Some videos you may like

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

chris115

New Member
Joined
Sep 29, 2006
Messages
9
Thanks, but I made a mistake - I meant how do I check if the worksheet is protected? Is it similar?
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
A Worksheet has these (read-only) properties:

ProtectContents
ProtectDrawingObjects
ProtectScenarios

So:

If ActiveSheet.ProtectContents = True Then
 

Watch MrExcel Video

Forum statistics

Threads
1,114,674
Messages
5,549,358
Members
410,910
Latest member
DessertDiva
Top