Problem with blocking 2 joined cells when they display a certain value (VBA)

benprelf

New Member
Joined
Aug 28, 2014
Messages
34
I posted on here yesterday for help with code regarding my original problem "Problem with blocking a cell when it displays a certain values (VBA)" and received this code:

Private Sub Worksheet(ByVal Target As range)
If Target.Address = "D10:E10" Then
ThisWorkbook.Sheets("abc").Unprotect
Cells.Locked = True
If range("D10:E10") = "MM" Then
range("J14:K14").Locked = False
Else
range("J14:K14").Locked = True
End If
range("D10:E10").Locked = False
ThisWorkbook.Sheets("abc").Protect
End If
End Sub

This solved my original problem however I now want to apply this to 2 sets of 2 joined cells.

I want to be able to block 2 cells "J14:K14" to prevent users from accessing them when cells "D10:E10" display all options but "MM".

When it displays "MM" I want users to be able to access the cells.

""D10:E10"" are the cells containing the drop down list from which the user can select options: "a","b","c" and "MM". While "J14:K14" are the cells that I want to block access to when they are not displaying "MM". "D10:E10" is linked to "J14:K14", so that when "MM" is not selected in the drop down "D10:E10", cells "J14:K14" become hidden but can still be accessed by the user if they accidentally interact with what is meant to be a blank space.
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,214,952
Messages
6,122,457
Members
449,083
Latest member
Ava19

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