Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Locking a sheet...

Hello,

Is there some kind of code that I code use, that if the sheet is locked/protected then cell A1 will say, "This sheet is protected", if it's not then I want it to say, "This sheet is not protected".

I'd appreciate any help with this. I have no experience in coding other than copying & pasting it in.

Jay
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Locking a sheet...

I wrote a formula that can check for the protection status
of a worksheet (where xlRange is any cell or range on the
sheet):

Public Function Protected(xlRange) As Byte

Protected = xlRange.Parent.ProtectContents * -4 _
+ xlRange.Parent.ProtectDrawingObjects * -2 _
+ xlRange.Parent.ProtectScenarios * -1

End Function

Returned value is non-zero if any protection option is
active; 4 for contents, 2 for objects, 1 for scenarios,
and the sum of the individual values for any combination
of these. So you could use this formula, say in cell A1:

=IF(Protected(A2)0,"This Sheet is Protected","This Sheet
is Not Protected")

BUT: changing the protection status of the sheet is not
enough to trigger a recalculation of this formula. So
this will work, but you may need to come up with a
creative way to trigger a recalculation of the cell. Have
not yet found a good solution - anyone out there have any
ideas?

-----Original Message-----
Hello,

Is there some kind of code that I code use, that if the

sheet is locked/protected then cell A1 will say, "This
sheet is protected", if it's not then I want it to
say, "This sheet is not protected".

I'd appreciate any help with this. I have no experience

in coding other than copying & pasting it in.

Jay

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
locking a sheet Brooks[_2_] Excel Discussion (Misc queries) 2 March 9th 08 11:16 PM
Locking A sheet Nigel Excel Discussion (Misc queries) 0 January 10th 07 06:37 PM
Locking Data Sheet AJ Excel Discussion (Misc queries) 2 August 28th 06 09:11 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Locking a sheet?? mcr1 Excel Discussion (Misc queries) 1 January 9th 06 05:31 PM


All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"