View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NeedHelp NeedHelp is offline
external usenet poster
 
Posts: 23
Default Password protect select sheets in a workbook

The macro below protects all worksheets in my workbook. I only want to
protect specific worksheets with the names Menu1, Menu2, etc. How would i
modify the macro to accomplish this. I know I can just select each worksheet
and protect it but I would like to learn the more advanced version below.
Sub ProtectSheets()
Dim mySheet As Worksheet
For Each mySheet In Worksheets
mySheet.Select
mySheet.protect "Password", True, True, True
Next mySheet
End Sub