Error when trying to lock 2 cells containing a drop down list

benprelf

New Member
Joined
Aug 28, 2014
Messages
34
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:

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.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,214,911
Messages
6,122,196
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top