Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / General Excel Questions / December 2007

Tip: Looking for answers? Try searching our database.

Pass word protecting multipul worksheets within a workbook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Terrie - 31 Dec 2007 20:53 GMT
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.
Bernard Liengme - 31 Dec 2007 21:23 GMT
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
Signature

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

> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.