password protect multiple spreadsheets in a workbook

G

Guest

How do i password protect multiple spreadsheets within a workbook? I want to
include several worksheets within a workboook but only allow certain people
to be able to access certain spreadsheets. How could i do this without moving
the spreadhseets to their own seperate files?
 
P

Paul B

You can with a macro,

Sub Protect_All_Sheets()
'will protect all sheets in the workbook
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="123"
Next ws
End Sub

Sub Protect_Selected_Sheets()
'will protect the selected sheets in the workbook
Set MySheets = ActiveWindow.SelectedSheets
For Each ws In MySheets
ws.Select
ws.Protect Password:="123"
Next ws
End Sub
 
G

Guest

Can you please further explain? With a macro??? how do i sub protect all
sheets? Im sorry im familiar with excel but apparently not was familiar as
you are... I sorda need one by one instructions?.. PLEASE THANK YOU SO MUCH!!
FOR REPLYING SOO QUICKLY.. But i do need further help. Thanks again!
 
P

Paul B

To put in this macro, from your workbook right-click the workbook's icon and
pick View Code. This icon is at the top-left of the spreadsheet this will
open the VBA editor, in Project Explorer click on your workbook name, if you
don't see it press CTRL + r to open the Project Explorer, then go to insert,
module, and paste the code in the window that opens on the right hand side,
press Alt and Q to close this window and go back to your workbook and press
alt and F8, this will bring up a box to pick the Macro from, click on the
Macro name to run it. If you are using excel 2000 or newer you may have to
change the macro security settings to get the macro to run. To change the
security settings go to tools, macro, security, security level and set it to
medium



you may also what to have a look here on getting started with macros

http://www.mvps.org/dmcritchie/excel/getstarted.htm




--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 

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

Top