how to protect multiple worksheets simultaneouslly and not one by
The following macro cycless through all the worksheets in the active
workbook, protecting them and assigning the password of "Password"
Sub ProtectAll()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ActiveWorkbook
For Each ws In wb.Worksheets
ws.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True, _
Password:="Password"
Next ws
Set wb = Nothing
Set ws = Nothing
End Sub
Place it in a VBA module by pressing Alt+F11, click INSERT on the menu and
select MODULE. You can either type the code above or cut and paste it. To
run the macro select TOOLS on the menu, click MACRO and then select MACROS.
The macro will be in the list of available macros. You can select it and
then click the RUN command button.
--
Kevin Backmann
"Kashif Sattar" wrote:
I want to protect all my sheets in a workbook but it takes me very long to
apply password on individual worksheets. I have more than 180 worksheets in
my workbook. I want to make all my sheets read only/hidden formulas and
protected by password so that no body can change unless provides correct
password.
Kindly help because i really need this. Thanks.
|