Using: Excel 2010
This portion of my code keeps failing and I am not sure why. When I try running the entire code block, it returns "Run-time error '1004': Unable to set the Locked property of the Range class".
'Lock/unlock issue
ThisWorkbook.Sheets("Dashboard").Activate
ActiveSheet.Unprotect Password:="my password"
Selection.Locked = False
Selection.FormulaHidden = False
If Range("D20").Value <> "Document Recorded" Then Range("F24").Locked = True Else Range("F24").Locked = False
ActiveSheet.Protect Password:="my password", DrawingObjects:=True, Contents:=True, Scenarios:=True
Basically, I am trying to say: If cell D20 does not equal "Document Recorded" then lock cell F24, otherwise unlock cell F24.