This site will look better if you upgrade to a browser that supports web standards.
When sheets are grouped (e.g., shift clicking on multiple sheets), they can no longer be password protected, since protection takes place on the sheet level. Here's a quick routine to unselect the grouped sheets, protect them individually, then group them again:
Public Sub ProtectGroupedSheets()
Const csPASSWD As String = "drowssap"
Dim mySheets As Sheets
Dim actSheet As Worksheet
Dim wkSht As Worksheet
Set actSheet = ActiveSheet
Set mySheets = ActiveWindow.SelectedSheets
actSheet.Select
For Each wkSht In mySheets
wkSht.Protect Password:=csPASSWD
Next wkSht
actSheet.Select
mySheets.Select False
End Sub
Unprotect just uses .Unprotect instead of .Protect
This page last updated
© Copyright 2001 - 2004 McGimpsey and Associates. Except where noted, all code on this site may be distributed under the Gnu GPL. Acknowledgement is appreciated.
Unfamilar with macros? See David McRitchie's Getting Started with Macros and User Defined Functions.