Protect sheets from editing but allowing macro to do so?

  • Thread starter Thread starter NooK
  • Start date Start date
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
 
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
 
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
 
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
 
To protect al sheets in the Workbook

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

Regards, Don
 
Thanks a lot. Mostly appreciated.
Worked like a charm.

Best Regards

Noo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top