can you protect multiple worksheets at thr same time

G

Guest

I have several multiple sheet workbooks where I need to protect the cells
that have formulas in them. is there a way I can protect serveral worksheets
at the same time? When I need to make changes to several of the worksheets it
takes forever to go in an unprotect each one, make the changes and then
proect each one again.I tried selecting them all but then the protection is
not an option avalible.

Thank you!
 
G

Guest

Hello,

Press [Alt][F11] on the keyboard to open the VB Editor.
Double click on This Workbook under the Microsoft Excel Objects.
-Paste this into the right of the screen:
Sub protectSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect password:="test"
Next ws
End Sub

Sub unprotectSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect password:="test"
Next ws
End Sub

-Change the word test if you want but leave what you change it to inside
double inverted commas.
-When you want to protect, click on the Tools menu, point to Macro and
select Macros...
-Click the one you want and click OK.
 

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

Top