I am trying to implement a functionality in excel where I have a column 'I' with a dropdown of some values. I have an adjacent column 'J' which needs to be enabled only on other selection of 'I' column else disabled.
I am able to run the code for a single cell: On I2 selection of 'other' as the data then J2 gets disabled. That part works fine. I am trying to implement the similar functionality through the entire I and J column instead of just I2 and J2. Can someone please help me with the logic here.
New to VBA coding in excel, so please explain me with the code. Really appreciate the help.
Here's my code:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect
If Range("I2").Value = "Urban Principal Arterial - Other" Or Range("I2").Value = "Rural Principal Arterial - Other" Or Range("I2").Value = "Urban Principal Arterial - Other F and E" Then
Range("J$2").Locked = True
Else: Range("$J$2").Locked = False
End If
ActiveSheet.Protect
End Sub
Thanks, Dimpy