Code to protect all the worksheets in a book
Hi Experts,
I need a code to protect all the sheets in a workbook dynamically. i may add sheets or delete sheets but protection of the sheets should be dynamic. thanks in advance. |
Quote:
Sub ProtectAllSheets() 'Protects ALL worksheets For Each Shts In ThisWorkbook.Worksheets Shts.Protect Password:=secret Next End Sub. if you are using excel 2007 version, copy this code to .xlsm (macro enabled) or excel 2003 you can directly copy to .xls spread sheet. all the best |
All times are GMT +1. The time now is 06:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com