Protect/unprotect all sheets at once?

W

wx4usa

Is there a way to protect or unprotect all sheets at once without
going into each sheet?
 
M

Max

Is there a way to protect or unprotect all sheets at once
without going into each sheet?

Some thoughts to get you going there ..
(subs taken from a posting by Norman Harker)

1. Copy everything within the dotted lines below
2. Press Alt+F11 to go to VBE
3. Click Insert > Module
4. Right-click in the code window (whitespace) on the right > Paste
5. Press Alt+Q to get back to Excel

To run the subs, press Alt+F8 to bring up the Macro dialog
Double click directly on the sub* (or select the sub in the dialog, click
Run)

*ProtectAllSheets (or UnprotectAllSheets)

'----
Sub ProtectAllSheets()
Dim n As Integer
For n = 1 To Worksheets.Count
Worksheets(n).Protect Password:="not4u2see"
Next n
End Sub

Sub UnprotectAllSheets()
Dim n As Integer
For n = 1 To Worksheets.Count
Worksheets(n).Unprotect Password:="not4u2see"
Next n
End Sub
'---

--
Max
Singapore
http://savefile.com/projects/236895
Downloads:16,000 Files:354 Subscribers:53
xdemechanik
---
 

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