Code to Protect all Worksheets

  • Thread starter Thread starter John
  • Start date Start date
J

John

Is it possible to protect all visible and invisible worksheets with the same
password with a piece of code.

Thanks
 
somthing like...

Option Explicit
Sub testme()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
wks.Protect Password:="hi"
Next wks
End Sub
 
Thanks Dave

Its a useful function

Dave Peterson said:
somthing like...

Option Explicit
Sub testme()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
wks.Protect Password:="hi"
Next wks
End Sub
 
Back
Top