-
Does anybody know how to find if an Excel worksheet is protected?
For example
If (sheet1 is protected) Then
MsgBox("Protected")
Else
MsgBox("Not Protected")
End If
I used .protect = true but this property actually protects
the sheet rather than return a value
Any ideas?
-
Not sure what you are doing but if you simply test the .protect attribute it should give you the result.
Code:
If Sheet1.protect Then
MsgBox "Protected"
Else
MsgBox "Unprotected"
End If
Don't forget by default all "If" statements evaluate to a boolean expression so you don't need to do "= true" or "= false" on the end as the attribute itself is boolean already