ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   simultaneous protection (https://www.excelbanter.com/excel-discussion-misc-queries/251363-simultaneous-protection.html)

Peese

simultaneous protection
 
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 ?

Jacob Skaria

simultaneous protection
 
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

--
Jacob


"Peese" wrote:

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 ?



All times are GMT +1. The time now is 12:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com