Protecting a workbook
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
Unprotect all sheets....................
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
Protect selected sheets..........................
Sub Protect_Selected_Sheets()
Application.ScreenUpdating = False
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Select
ws.Protect Password:="justme"
Next ws
Application.ScreenUpdating = True
End Sub
Unprotect selected sheets................
Sub UnProtect_Selected_Sheets()
Application.ScreenUpdating = False
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Select
ws.UnProtect Password:="justme"
Next ws
Application.ScreenUpdating = True
End Sub
Gord Dibben MS Excel MVP
On Thu, 25 Sep 2008 16:39:01 -0700, Kim
wrote:
Hi,
I have no problem protecting a worksheet with the 'Protect Sheet' option,
but is there anyway i can protect the whole workbook the same way, without
having to select each sheet individually?
Thanks in advanced!
|