ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   protecting the entire worksheet (https://www.excelbanter.com/excel-programming/422124-protecting-entire-worksheet.html)

Hartmut \(Harry\) Kloppert

protecting the entire worksheet
 
I'm using Office 2007

Thru VBA-coding I'm protecting my worksheet so that the users
can only select and enter data into certain fields (those fields have
been unchecked for "Locked" in the Format Cells.../Protection).

At a certain event (pushbutton) I would like to have those unprotected
cells also being protected ("no more input allowed") until another "Reset"-
event/pushbutton opens up those cells again for input.

I didn't find any VBA-Help for such a coding...
Any proposal?

Harry



Per Jessen

protecting the entire worksheet
 
Hi Harry

Unprotect the sheet, change the Locked property for the desired cells to
True and reprotect the sheet. To reset just change the Locked property to
False.

'Protect TargetCells
Sheets("Sheet1").Unprotect
Range("TargetCells").Locked = True
Sheets("Sheet1").Protect

Regards,
Per

"Hartmut (Harry) Kloppert" skrev i meddelelsen
...
I'm using Office 2007

Thru VBA-coding I'm protecting my worksheet so that the users
can only select and enter data into certain fields (those fields have
been unchecked for "Locked" in the Format Cells.../Protection).

At a certain event (pushbutton) I would like to have those unprotected
cells also being protected ("no more input allowed") until another
"Reset"-
event/pushbutton opens up those cells again for input.

I didn't find any VBA-Help for such a coding...
Any proposal?

Harry



Hartmut \(Harry\) Kloppert

protecting the entire worksheet
 
Thank you Per, that works perfectly.
(I didn't find anything in the Help-file though)

Harry

"Per Jessen" wrote in message
...
Hi Harry

Unprotect the sheet, change the Locked property for the desired cells to
True and reprotect the sheet. To reset just change the Locked property to
False.

'Protect TargetCells
Sheets("Sheet1").Unprotect
Range("TargetCells").Locked = True
Sheets("Sheet1").Protect

Regards,
Per

"Hartmut (Harry) Kloppert" skrev i meddelelsen
...
I'm using Office 2007

Thru VBA-coding I'm protecting my worksheet so that the users
can only select and enter data into certain fields (those fields have
been unchecked for "Locked" in the Format Cells.../Protection).

At a certain event (pushbutton) I would like to have those unprotected
cells also being protected ("no more input allowed") until another
"Reset"-
event/pushbutton opens up those cells again for input.

I didn't find any VBA-Help for such a coding...
Any proposal?

Harry





Per Jessen

protecting the entire worksheet
 
Hi Harry,

Thanks for your reply, I'm glad that you made it work

Per

"Hartmut (Harry) Kloppert" skrev i meddelelsen
...
Thank you Per, that works perfectly.
(I didn't find anything in the Help-file though)

Harry




All times are GMT +1. The time now is 03:25 PM.

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