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
 

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

Back
Top