I want to be able to lock 2 cells containing a drop down list (both cells contain the same list), but only if a certain value is selected in another drop down list that the former is linked to.
Otherwise I would like the cells to be unlocked. The code I am using is:
When attempting to run the code I receive "Run-time error '424' Object required" on this line:
Any help would be much appreciated.
Otherwise I would like the cells to be unlocked. The code I am using is:
Code:
Sub BlockFibre()
If Target.Address = "D10:E10" Then 'These cells contain the drop down list I do not want to lock
ThisWorkbook.Sheets("CreateCableEXM").Unprotect
Cells.Locked = True
If ThisWorkbook.Sheets("CreateCableEXM").range("D10:E10") = "MM" Then
Set ThisWorkbook.Sheets("CreateCableEXM").range("J14:K14").Locked = False 'These cells contain the drop down list I want to lock
Else
ThisWorkbook.Sheets("CreateCableEXM").range("J14:K14").Locked = True
End If
Set ThisWorkbook.Sheets("CreateCableEXM").range("D10:E10").Locked = False
ThisWorkbook.Sheets("CreateCableEXM").Protect
End If
End Sub
When attempting to run the code I receive "Run-time error '424' Object required" on this line:
Code:
If Target.Address = "D10:E10" Then
Any help would be much appreciated.