ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protection (https://www.excelbanter.com/excel-programming/276379-re-protection.html)

Trevor Shuttleworth

Protection
 
Janet

ActiveSheet.Unprotect Password:="drowssap"

ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True, Password:="drowssap"

You don't say what your problem is. Is it with changing the data or the
protection/unprotection ?

Regards

Trevor

"janet" wrote in message
...
I am working in a protected worksheet and when a radio
button is selected, it should unprotect the Sheet, Change
values in Cells and re-protect. I can't get the syntax
correct. I thought it should be

ActiveSheet.Unprotect Password:="password"

Then select the range, change and re-protect.







janet

Protection
 
Getting the Error Message

Runtime Error 1004

Unprotect Method of Worksheet class failed.
-----Original Message-----
Janet

ActiveSheet.Unprotect Password:="drowssap"

ActiveSheet.Protect DrawingObjects:=True,

Contents:=True,
Scenarios:=True, Password:="drowssap"

You don't say what your problem is. Is it with changing

the data or the
protection/unprotection ?

Regards

Trevor

"janet" wrote in message
...
I am working in a protected worksheet and when a radio
button is selected, it should unprotect the Sheet,

Change
values in Cells and re-protect. I can't get the syntax
correct. I thought it should be

ActiveSheet.Unprotect Password:="password"

Then select the range, change and re-protect.






.


janet

Protection
 
The code is behind an option button. When the option
button is selected, the sheet should become unprotected so
that values in certain locked cells may be changed. After
the changes, the cells are to become protected again.
-----Original Message-----
Janet

where is your code?

Regards

Trevor


"janet" wrote in message
...
Getting the Error Message

Runtime Error 1004

Unprotect Method of Worksheet class failed.
-----Original Message-----
Janet

ActiveSheet.Unprotect Password:="drowssap"

ActiveSheet.Protect DrawingObjects:=True,

Contents:=True,
Scenarios:=True, Password:="drowssap"

You don't say what your problem is. Is it with

changing
the data or the
protection/unprotection ?

Regards

Trevor

"janet" wrote in message
...
I am working in a protected worksheet and when a

radio
button is selected, it should unprotect the Sheet,

Change
values in Cells and re-protect. I can't get the

syntax
correct. I thought it should be

ActiveSheet.Unprotect Password:="password"

Then select the range, change and re-protect.






.



.


John Wilson

Protection
 
janet,

By "Where is your code", I believe that Trevor meant for you to
copy and paste the section of code that you're using to a message
and post it in this thread.

John

janet wrote:

The code is behind an option button. When the option
button is selected, the sheet should become unprotected so
that values in certain locked cells may be changed. After
the changes, the cells are to become protected again.
-----Original Message-----
Janet

where is your code?

Regards

Trevor


"janet" wrote in message
...
Getting the Error Message

Runtime Error 1004

Unprotect Method of Worksheet class failed.
-----Original Message-----
Janet

ActiveSheet.Unprotect Password:="drowssap"

ActiveSheet.Protect DrawingObjects:=True,
Contents:=True,
Scenarios:=True, Password:="drowssap"

You don't say what your problem is. Is it with

changing
the data or the
protection/unprotection ?

Regards

Trevor

"janet" wrote in message
...
I am working in a protected worksheet and when a

radio
button is selected, it should unprotect the Sheet,
Change
values in Cells and re-protect. I can't get the

syntax
correct. I thought it should be

ActiveSheet.Unprotect Password:="password"

Then select the range, change and re-protect.






.



.



John Wilson

Protection
 
janet,

Tried your code and it works for me???
Might I suggest a different approach??
In your workbook_open event (or an Auto_Open sub in
a regular module):

activesheet.protect password:="password", userinterfaceonly:=true
<change activesheet to Worksheets("yoursheetname")

With the above, the sheet will remain protected but allow changes to be
made via code.

John


janet wrote:

Sorry: Here it is....

Private Sub opt2Sigsrequired_Click()

If Range("d3").Value = True Then
ActiveSheet.Unprotect Password:="Password"
Range
("B14,B17,b20,b23,b37,b40,b43,b46,b60,b63,b66,b69" ).Value
= "Payee"

Rows("17:47").Select
Selection.EntireRow.Hidden = False
Range("C4").Select
Range
("16:16,19:19,22:22,25:25,36:36,39:39,42:42,45:45, 48:48,59:
59,62:62,65:65,68:68,71:71").Select
Range("A22").Activate
Selection.EntireRow.Hidden = True

ActiveSheet.Protect Password:="Password"

End If

-----Original Message-----
janet,

By "Where is your code", I believe that Trevor meant for

you to
copy and paste the section of code that you're using to a

message
and post it in this thread.

John

janet wrote:

The code is behind an option button. When the option
button is selected, the sheet should become unprotected

so
that values in certain locked cells may be changed.

After
the changes, the cells are to become protected again.
-----Original Message-----
Janet

where is your code?

Regards

Trevor


"janet" wrote in message
...
Getting the Error Message

Runtime Error 1004

Unprotect Method of Worksheet class failed.
-----Original Message-----
Janet

ActiveSheet.Unprotect Password:="drowssap"

ActiveSheet.Protect DrawingObjects:=True,
Contents:=True,
Scenarios:=True, Password:="drowssap"

You don't say what your problem is. Is it with
changing
the data or the
protection/unprotection ?

Regards

Trevor

"janet" wrote in message
...
I am working in a protected worksheet and when a
radio
button is selected, it should unprotect the Sheet,
Change
values in Cells and re-protect. I can't get the
syntax
correct. I thought it should be

ActiveSheet.Unprotect Password:="password"

Then select the range, change and re-protect.






.



.


.



Dave Peterson[_3_]

Protection
 
Are you running xl97?

If yes, add:

activecell.activate

at the top of your code.

(For controls that have a .takefocusonclick property, you can change that to
false.)

(This is a bug that was fixed in xl2k.)



janet wrote:

Getting the Error Message

Runtime Error 1004

Unprotect Method of Worksheet class failed.
-----Original Message-----
Janet

ActiveSheet.Unprotect Password:="drowssap"

ActiveSheet.Protect DrawingObjects:=True,

Contents:=True,
Scenarios:=True, Password:="drowssap"

You don't say what your problem is. Is it with changing

the data or the
protection/unprotection ?

Regards

Trevor

"janet" wrote in message
...
I am working in a protected worksheet and when a radio
button is selected, it should unprotect the Sheet,

Change
values in Cells and re-protect. I can't get the syntax
correct. I thought it should be

ActiveSheet.Unprotect Password:="password"

Then select the range, change and re-protect.






.


--

Dave Peterson


Trevor Shuttleworth

Protection
 
Janet

works for me also in Excel 2000. I was actually wondering where the code
was located, that is, in a sheet module or a general module in case that
made a difference. However, John's interpretation of the question should
have been asked too as seeing the code often helps. As I said, worked for
me so running out of ideas at present.

Regards

Trevor


"janet" wrote in message
...
Sorry: Here it is....

Private Sub opt2Sigsrequired_Click()

If Range("d3").Value = True Then
ActiveSheet.Unprotect Password:="Password"
Range
("B14,B17,b20,b23,b37,b40,b43,b46,b60,b63,b66,b69" ).Value
= "Payee"


Rows("17:47").Select
Selection.EntireRow.Hidden = False
Range("C4").Select
Range
("16:16,19:19,22:22,25:25,36:36,39:39,42:42,45:45, 48:48,59:
59,62:62,65:65,68:68,71:71").Select
Range("A22").Activate
Selection.EntireRow.Hidden = True

ActiveSheet.Protect Password:="Password"

End If

-----Original Message-----
janet,

By "Where is your code", I believe that Trevor meant for

you to
copy and paste the section of code that you're using to a

message
and post it in this thread.

John

janet wrote:

The code is behind an option button. When the option
button is selected, the sheet should become unprotected

so
that values in certain locked cells may be changed.

After
the changes, the cells are to become protected again.
-----Original Message-----
Janet

where is your code?

Regards

Trevor


"janet" wrote in message
...
Getting the Error Message

Runtime Error 1004

Unprotect Method of Worksheet class failed.
-----Original Message-----
Janet

ActiveSheet.Unprotect Password:="drowssap"

ActiveSheet.Protect DrawingObjects:=True,
Contents:=True,
Scenarios:=True, Password:="drowssap"

You don't say what your problem is. Is it with
changing
the data or the
protection/unprotection ?

Regards

Trevor

"janet" wrote in message
...
I am working in a protected worksheet and when a
radio
button is selected, it should unprotect the Sheet,
Change
values in Cells and re-protect. I can't get the
syntax
correct. I thought it should be

ActiveSheet.Unprotect Password:="password"

Then select the range, change and re-protect.






.



.


.





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com