Fair warning: Complete VBA novice here.
I have a sheet that I am sending out. The form has a cell (D8) where a selection is made from a drop down list. Based on the selection in that list, I want to have certain areas of the sheet lock and unlock so that the only part of the form they can fill in is pertaining to their selection in D8. So say they enter "Montana" in the drop down, I only want the section of the form that has areas applicable to that choice to be editable. I will then have various ranges locking and unlocking based on the selection in this drop-down.
Here is what I have so far:
Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveSheet.Cells(8, 4).Text = "Montana" Then
ActiveSheet.Range(Cells(14, 1), Cells(15, 6)).Locked = False
Else
ActiveSheet.Range(Cells(14, 1), Cells(15, 6)).Locked = True
End If
End Sub
But when I go and attempt to test wether the range has been locked I can still edit the cells while the sheet is protected even if the condition has been met.