Protecting and Unprotecting several worksheets at one time
I think I figured it out. Right clicked on one of the tabs, selected View
Code, then pasted the code you provided. Earlier, Excel did not appear to be
saving the code because there were no Macros listed when I closed and
reopened the file. This time it seemed to work. Did I do it correctly?
"Jaime" wrote:
This is very helpful, but I have almost no VBA experience. Can you provide
some direction on how to get this code in my spreadsheet?
"Gord Dibben" wrote:
Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim N As Single
For N = 1 To Sheets.Count
Sheets(N).Protect Password:="justme"
Next N
Application.ScreenUpdating = True
End Sub
Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim N As Single
For N = 1 To Sheets.Count
Sheets(N).Unprotect Password:="justme"
Next N
Application.ScreenUpdating = True
End Sub
Sub Protect_Selected_Sheets()
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Select
ws.Protect Password:="justme"
Next ws
End Sub
Gord Dibben MS Excel MVP
On Thu, 25 Sep 2008 13:44:01 -0700, StayinAlive
wrote:
Is it possible to get your macro for this?
Thank you!
|