ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protecting Cells with macros (https://www.excelbanter.com/excel-programming/307335-protecting-cells-macros.html)

Peter McCaul

Protecting Cells with macros
 
I would like to protect 4 cells in my document so changes cannot be made to
them. The rest of the cells I would like to leave unprotected. I took the
lock off the rest of the cells and I protected my worksheet. It worked fine
but the only problem is I can't run my macros. Is there a way I can run my
macros and protect my cells. Any help is appreciated. Thanks.



Norman Jones

Protecting Cells with macros
 
Hi Peter,

One way is to amend your macros to initially unprotect the sheet and finally
reprotect the sheet.

An alternative approach would be to set Protect's UserInterfaceOnly argument
to True. This setting is not persistent and so needs to be reset each time
the workbook is opened.

---
Regards,
Norman



"Peter McCaul" wrote in message
...
I would like to protect 4 cells in my document so changes cannot be made

to
them. The rest of the cells I would like to leave unprotected. I took

the
lock off the rest of the cells and I protected my worksheet. It worked

fine
but the only problem is I can't run my macros. Is there a way I can run my
macros and protect my cells. Any help is appreciated. Thanks.





Tom Ogilvy

Protecting Cells with macros
 
have you code unprotect the worksheet, run, reprotect the worksheet

Use the UserInterfaceOnly argument set to true in a protect statement.

See help for the protect method for details.

--
Regards,
Tom Ogilvy


"Peter McCaul" wrote in message
...
I would like to protect 4 cells in my document so changes cannot be made

to
them. The rest of the cells I would like to leave unprotected. I took

the
lock off the rest of the cells and I protected my worksheet. It worked

fine
but the only problem is I can't run my macros. Is there a way I can run my
macros and protect my cells. Any help is appreciated. Thanks.






All times are GMT +1. The time now is 09:33 AM.

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