Protect/unprotect all sheets at once?

  • Thread starter Thread starter wx4usa
  • Start date Start date
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
---
 
Back
Top