simultaneous protection

P

Peese

I have set up a workbook containing 15 sheets. 12 of them are named Jan to
Dec.
I KNOW how to protect each one, but is it possible to protect all twelve in
one go ?
 
J

Jacob Skaria

You can try out the below macro. If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()>


Sub ProtectSheets()
Dim intCount As Integer
For intCount = 1 To 12
Sheets(CStr(MonthName(intCount, True))).Protect Password:="password"
Next
End Sub

Sub UnProtectSheets()
Dim intCount As Integer
For intCount = 1 To 12
Sheets(CStr(MonthName(intCount, True))).UnProtect Password:="password"
Next
End Sub
 

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