Hello,
I'm trying to create a macro to protect all sheets at the same time. Below is what I have been trying, but its not working. ANy ideas?
Sub protectsheets()
Dim wSheet As Worksheet
For Each wSheet In ActiveWorkbook.Worksheets
wSheet.Protect Password:="margin"
Next wSheet
End Sub
Sub unprotectsheets()
Dim wSheet As Worksheet
For Each wSheet In ActiveWorkbook.Worksheets
wSheet.Protect Password:="margin"
Next wSheet
End Sub
I'm trying to create a macro to protect all sheets at the same time. Below is what I have been trying, but its not working. ANy ideas?
Sub protectsheets()
Dim wSheet As Worksheet
For Each wSheet In ActiveWorkbook.Worksheets
wSheet.Protect Password:="margin"
Next wSheet
End Sub
Sub unprotectsheets()
Dim wSheet As Worksheet
For Each wSheet In ActiveWorkbook.Worksheets
wSheet.Protect Password:="margin"
Next wSheet
End Sub