I found the following code:
' Loop through all sheets in the workbook
For I = 1 To Sheets.Count
' Activate each sheet in turn.
response = MsgBox("Do you want to protect this sheet?", vbYesNo)
If response = vbYes Then
ActiveSheet.Protect Password:="****", DrawingObjects:=True, _
ElseIf response = vbNo Then
MsgBox ("Sheet not protected")
I have been using this successfully - but is there an easy way to perhaps modify it so that instead of looping through the entire workbook, it could just lock every sheet with the exception of "Sheet1" and "Sheet2"?
The other constraints are that I don't know how many sheets they may be in every book I need to use this on :(
Thanks in advance!