22 | 02 | 2017

Protect all Sheets in a Workbook

 Code below protects all sheets in a workbook

Sub ProtectAllSheets()
 
'****************************************
'*** Code from VisibleVisual.com ********
'****************************************
 
Dim a As Integer
 
Dim sheetcount As Integer
sheetcount = Application.Sheets.count
 
Sheets(1).Select    'Selects the first sheet
 
For a = 1 To sheetcount
 
ActiveSheet.Protect
 
If a = sheetcount Then Exit Sub
 
ActiveSheet.Next.Select
 
Next a
 
End Sub

 

 

 

Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2174961
Latest Articles