Sheet protection

  • Thread starter Thread starter OK
  • Start date Start date
O

OK

Could someone please supply me with the VBA to test and
determine if a sheet is protected or not?

Also, if a workbook is protected or not?

Two functions that return a boolean is what I'm after...

Thanks much.
 
Try this

Sub Test()
If ActiveSheet.ProtectContents = True Then
MsgBox "Protect"
Else
MsgBox "not protect"
End If
End Sub

For the workbook use
ActiveWorkbook.ProtectStructure = True
 

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