Lock / Unlock Macro Having Issues with Sheet activation syntax
So I know that my sheet needs to be selected in order to lock or unlock but I keep getting errors on line #10 and I can't seem to figure out how I need to make each sheet active. I know the solution is probably incredibly easy but I wasn't able to figure it out :-(
Sub Lock_Unlock()
'
' Lock_Unlock Macro
' Locks or Unlocks Worksheet
'
' Keyboard Shortcut: Ctrl+Shift+L
Dim ws As Worksheet
For Each ws In Worksheets <----------------------------------- Error here
If Worksheet.Protect = True Then
Worksheet.Unprotect Password:="cats"
Else
Worksheet.Protect Password:="cats"
End If
Next ws
End Sub
Posted Mar 12, 2018, 9:11 PM UTC
12