Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 45
Default Worksheet Protection with caviot

I have protected my workbook so users can only modify certain cells. I have
a Button to clear all cells, but when I protect the workbook, the button is
protected too. How do I unprotect this button? Currently, if the workbook
is protected, the button gives a runtime error which says the workbook needs
to be unprotected.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default Worksheet Protection with caviot

I don't think it is the button that is "protected"; rather, it is the
protected cells you are trying to clear when you press the button that is
your problem. Look up the Protect Method in the VBA help files... I think
you will have to execute an Activesheet.Protect statement at the beginning
of the macro assigned to the button and and Activesheet.Unprotect statemen
at the end of the macro assigned to the button, setting and resetting the
applicable arguments for this method at each location.

Rick


"Karen Smith" wrote in message
...
I have protected my workbook so users can only modify certain cells. I
have
a Button to clear all cells, but when I protect the workbook, the button
is
protected too. How do I unprotect this button? Currently, if the
workbook
is protected, the button gives a runtime error which says the workbook
needs
to be unprotected.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 45
Default Worksheet Protection with caviot

Thanks Rick for responding. I don't know how to look up the Protect Method
in the VBA help files. In fact I don't know where/what the VBA help files
are. Is there a link you can send me to? or would you happen to know what
the statement is I need to put in my macro?

My macro reads as follows:

Range( _

"I4:I6,I9,I11,I13,I15,I17,I19,I21,I23,B25,B27,B29, D25,D27,D29,F25,F27,F29,H25,H27,H29,J25,J27" _
).Select
Range("J27").Activate
Selection.ClearContents
Range("I4:I6").Select

What would the

"Rick Rothstein (MVP - VB)" wrote:

I don't think it is the button that is "protected"; rather, it is the
protected cells you are trying to clear when you press the button that is
your problem. Look up the Protect Method in the VBA help files... I think
you will have to execute an Activesheet.Protect statement at the beginning
of the macro assigned to the button and and Activesheet.Unprotect statemen
at the end of the macro assigned to the button, setting and resetting the
applicable arguments for this method at each location.

Rick


"Karen Smith" wrote in message
...
I have protected my workbook so users can only modify certain cells. I
have
a Button to clear all cells, but when I protect the workbook, the button
is
protected too. How do I unprotect this button? Currently, if the
workbook
is protected, the button gives a runtime error which says the workbook
needs
to be unprotected.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default Worksheet Protection with caviot

It's a little hard to give you the statement to use because it depends on
what options you have checked off in the Tools/ProtectSheet dialog box. Each
option that you can check off has an equivalent argument that can be set to
True or False. If you only have the first two items check, they are
defaulted to True in the Protect and Unprotect methods which would mean all
you have to do is add ActiveSheet.Unprotect as the first line in your macro
and ActiveSheet.Protect as the last line in your macro. However, if you have
any other items checked, then you will need to handle them via those
method's arguments. You can see the help files on this arguments by going
into the VBA editor (where your macro code is), type the word "protect" (or
"unprotect") without the quote marks in the Immediate window, or in the code
window (don't forget to delete it from here afterwards), and then press F1
(while your cursor is next to or within the word).

Rick

"Karen Smith" wrote in message
...
Thanks Rick for responding. I don't know how to look up the Protect
Method
in the VBA help files. In fact I don't know where/what the VBA help files
are. Is there a link you can send me to? or would you happen to know what
the statement is I need to put in my macro?

My macro reads as follows:

Range( _

"I4:I6,I9,I11,I13,I15,I17,I19,I21,I23,B25,B27,B29, D25,D27,D29,F25,F27,F29,H25,H27,H29,J25,J27"
_
).Select
Range("J27").Activate
Selection.ClearContents
Range("I4:I6").Select

What would the

"Rick Rothstein (MVP - VB)" wrote:

I don't think it is the button that is "protected"; rather, it is the
protected cells you are trying to clear when you press the button that is
your problem. Look up the Protect Method in the VBA help files... I think
you will have to execute an Activesheet.Protect statement at the
beginning
of the macro assigned to the button and and Activesheet.Unprotect
statemen
at the end of the macro assigned to the button, setting and resetting the
applicable arguments for this method at each location.

Rick


"Karen Smith" wrote in message
...
I have protected my workbook so users can only modify certain cells. I
have
a Button to clear all cells, but when I protect the workbook, the
button
is
protected too. How do I unprotect this button? Currently, if the
workbook
is protected, the button gives a runtime error which says the workbook
needs
to be unprotected.




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
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
Help with Worksheet protection please Jim Ryan Excel Discussion (Misc queries) 2 July 30th 06 07:17 AM
Worksheet protection is gone and only wokbook protection can be se Eric C. Excel Discussion (Misc queries) 4 May 2nd 06 04:50 PM
Worksheet Protection Angeline Excel Discussion (Misc queries) 3 March 20th 06 12:49 PM
Worksheet Protection [email protected] Excel Discussion (Misc queries) 3 June 16th 05 11:29 PM


All times are GMT +1. The time now is 12:44 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"