In this tutorial you will learn how protect and unprotect all worksheets in one go using VBA macro programming in Microsoft Excel
VBA Code:
'This code will protect all the sheets at one go
Sub ProtectAllSheets()
Dim ws As Worksheet
Dim password As String
password = "Pass123" 'replace Test123 with the password you want
For Each ws In Worksheets
ws.Protect password:=password
Next ws
End Sub
'This code will unprotect all the sheets at one go
Sub UnprotectAllSheets()
Dim ws As Worksheet
Dim password As String
password = "Pass123" 'replace Test123 with the password you want
For Each ws In Worksheets
ws.Unprotect password:=password
Next ws
End Sub