Protecting more than one worksheet at a time

D

Donnah

Is there any way to protect more than one worksheet at a time without have to
right click on each worksheets tab and choose 'Protect Sheet'?
 
J

Jim Thomlinson

Nothing built in but you can do it with a fairly simple macro. I have created
an addin for myself with the code in it to make it easy to do...

Public Sub ProtectAll()
Dim wks As Worksheet
Dim wksAll As Sheets

Application.ScreenUpdating = False
If ActiveWindow.SelectedSheets.Count > 1 Then
Set wksAll = ActiveWindow.SelectedSheets
Else
Set wksAll = ActiveWorkbook.Worksheets
End If
On Error Resume Next
For Each wks In wksAll
Select Case Trim(wks.Name)
Case "Start" 'excluded sheet
Case "Main" 'excluded sheet
Case Else
wks.Protect "MyPassword"
End Select
Next wks
Application.ScreenUpdating = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top