Programmatically determining if worksheet is protected

B

Barb Reinhardt

How would I check to see if the activesheet is protected? I know how to
protect and unprotect programmatically, but only want to unprotect it if it's
already protected.

Thanks
 
B

Bob Phillips

If Worksheets("Sheet1").ProtectContents = True Then
MsgBox "The contents of Sheet1 are protected."
End If
--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
J

Jim Thomlinson

It is not really worth checking. Just run the unprotect. You can however
check to see if it is protected something like this...

dim wks as worksheet

for each wks in worksheets
if wks.protectcontents = true then wks.unprotect
next wks
 

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

Top