Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create a Macro to open worksheets( 30 or 31 sheets in one
work book) and protect with password.

Any Help will be appreciated.

Thanks
 
Hi
as a starting point I would try to record a macro while doing this
manually. This should give you the right direction
 
Deep

Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="justme"
Next n
Application.ScreenUpdating = True
End Sub

Sub UnprotectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Unprotect Password:="justme"
Next n
Application.ScreenUpdating = True
End Sub

Gord Dibben Excel MVP
 

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