Sunday, April 21, 2019

Protect all worksheets and unprotect


Protect all worksheets and unprotect


Sub ProtectAll()

Dim wsheet As Worksheet

For Each wsheet In ActiveWorkbook.Worksheets

wsheet.Protect password:="123"

Next wsheet

End Sub
----------------------------------------------------------------------------
Sub DeProtectAll()

Dim wsheet As Worksheet



    For Each wsheet In ActiveWorkbook.Worksheets
    wsheet.Unprotect password:="123"
     
       
    Next wsheet
End Sub

No comments:

Post a Comment