View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default Pass word protecting multipul worksheets within a workbook

This will do it

Sub Macro1()
Dim strPassword As String
Dim mySheet As Worksheet
For Each mySheet In Worksheets
strPassword = InputBox("Enter the password for the worksheet")
mySheet.Protect Password:=strPassword, Scenarios:=True
Next
End Sub

If you wish to use a single password
Sub Macro1()
Dim strPassword As String
Dim mySheet As Worksheet
strPassword = InputBox("Enter the password for the worksheet")
For Each mySheet In Worksheets
mySheet.Protect Password:=strPassword, Scenarios:=True
Next
End Sub

Need hep with VBA? David McRitchie's site on "getting started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Happy New Year
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Terrie" wrote in message
...
is there a way to pass word protect multiful worksheets within a workbook
at
the same time.

i have several workbooks that have 5-35 worksheets that all need pass word
protected and would like to do it all at the same time.