View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Is the active worksheet protected?

Hi mrthomas,

The object variable ActiveSheet will refer to the active worksheet. So your
code would just be this:

If ActiveSheet.ProtectContents Then
MsgBox "This worksheet is protected."
Else
'/ Perform code
End If

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


mthomas wrote:
hey all,

I know how to determine if a worksheet is protected. For example:

If WorkSheets("name_here").ProtectContents = True Then
MsgBox ("This worksheet is protected.")
Else
'Perform code
End If

But this situation calls for determining if the ACTIVE worksheet is
protected. In other words, the user creates a new worksheet everyday
and changes its name. We need to determine if that worksheet is
protected or not. How can we accomplish this? Thanks in advance for
the expertise!