Protect sheets from editing but allowing macro to do so?

N

NooK

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
 
N

Norman Jones

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
 
N

Norman Jones

Hi Nook,

Typo warning!

The code should read:

Replace activesheet with sh


---
Regards,
Norman



Norman Jones said:
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
 
N

Norman Jones

To remove unintentional confusion:

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

---
Regards,
Norman

--

---
Regards,
Norman



Norman Jones said:
Hi Nook,

Typo warning!

The code should read:

Replace activesheet with sh
 
D

Don Lloyd

To protect al sheets in the Workbook

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

Regards, Don
 
Top