ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protect sheets from editing but allowing macro to do so? (https://www.excelbanter.com/excel-programming/306088-protect-sheets-editing-but-allowing-macro-do-so.html)

NooK[_52_]

Protect sheets from editing but allowing macro to do so?
 
Is it possible to protect all the sheets from a workbook from editio
allowing the macros to edit the cells and so on?

Best Regards

Noo

--
Message posted from http://www.ExcelForum.com


Norman Jones

Protect sheets from editing but allowing macro to do so?
 
Hi Nook,

Try:

Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
ActiveSheet.Protect password:="PW", _
UserInterfaceOnly:=True
Next


Replace PW with your designated password


---
Regards,
Norman



"NooK " wrote in message
...
Is it possible to protect all the sheets from a workbook from edition
allowing the macros to edit the cells and so on?

Best Regards

NooK


---
Message posted from http://www.ExcelForum.com/




Norman Jones

Protect sheets from editing but allowing macro to do so?
 
Hi Nook,

Typo warning!

The code should read:

Replace activesheet with sh


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Nook,

Try:

Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
ActiveSheet.Protect password:="PW", _
UserInterfaceOnly:=True
Next


Replace PW with your designated password


---
Regards,
Norman



"NooK " wrote in message
...
Is it possible to protect all the sheets from a workbook from edition
allowing the macros to edit the cells and so on?

Best Regards

NooK


---
Message posted from http://www.ExcelForum.com/






Norman Jones

Protect sheets from editing but allowing macro to do so?
 
To remove unintentional confusion:

For Each sh In ActiveWorkbook.Sheets
sh.Protect password:="PW", _
UserInterfaceOnly:=True
Next sh

---
Regards,
Norman

--

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Nook,

Typo warning!

The code should read:

Replace activesheet with sh


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Nook,

Try:

Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
ActiveSheet.Protect password:="PW", _
UserInterfaceOnly:=True
Next


Replace PW with your designated password


---
Regards,
Norman



"NooK " wrote in message
...
Is it possible to protect all the sheets from a workbook from edition
allowing the macros to edit the cells and so on?

Best Regards

NooK


---
Message posted from http://www.ExcelForum.com/








Don Lloyd

Protect sheets from editing but allowing macro to do so?
 
To protect al sheets in the Workbook

For each Sh in Worksheets.Count
Sh.Protect UserInterFaceOnly:=True
Next

Regards, Don

"NooK " wrote in message
...
Is it possible to protect all the sheets from a workbook from edition
allowing the macros to edit the cells and so on?

Best Regards

NooK


---
Message posted from http://www.ExcelForum.com/




NooK[_53_]

Protect sheets from editing but allowing macro to do so?
 
Thanks a lot. Mostly appreciated.
Worked like a charm.

Best Regards

Noo

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 01:20 PM.

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