Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Using "protection" as a macro condition

Is there a way to refer to "protection" (its on/off condition), in a Macro
line?
A simple example would be -

If "protection is off" Then Worksheets("abc").Range("a5").Value = 0

I need to know the coding to use that would replace "protection is off" in
the above line. It could also be connected to whether or not there is a
password present.
I hope this can be done.
Ed
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using "protection" as a macro condition

Look at help on

Protectcontents
ProtectDrawingObject
ProtectScenarios

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


In excel 2002 and later, also look at the protection object.

I am not away of any property that will tell you if a password is required.
No sure how useful it would be as you can try to unprotect the sheet without
one, then see if you were successful or check the error (using On Error
Resume Next to ignore an error response).

--
Regards,
Tom Ogilvy

"Ed" wrote in message
...
Is there a way to refer to "protection" (its on/off condition), in a Macro
line?
A simple example would be -

If "protection is off" Then Worksheets("abc").Range("a5").Value = 0

I need to know the coding to use that would replace "protection is off" in
the above line. It could also be connected to whether or not there is a
password present.
I hope this can be done.
Ed



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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Change default in input box from "20" to "000000"? Have macro continue on to name sheet tab? StargateFanFromWork[_4_] Excel Programming 7 October 29th 06 11:46 AM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
Stop users from accessing "Protection" option from "Tools" menu I Believe Excel Programming 2 December 19th 05 02:44 PM
Sending macro based e-mail with built-in "Heading" and "Text" Prabha Excel Programming 3 January 17th 05 02:11 PM


All times are GMT +1. The time now is 07:00 AM.

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"