![]() |
Is the active worksheet protected?
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! -- mthomas ------------------------------------------------------------------------ mthomas's Profile: http://www.excelforum.com/member.php...o&userid=25649 View this thread: http://www.excelforum.com/showthread...hreadid=396153 |
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! |
Is the active worksheet protected?
Thanks a lot Jake, it works great -- mthoma ----------------------------------------------------------------------- mthomas's Profile: http://www.excelforum.com/member.php...fo&userid=2564 View this thread: http://www.excelforum.com/showthread.php?threadid=39615 |
All times are GMT +1. The time now is 10:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com