Hi, Can anyone please help?
I need to amend the code so that the Row Range selection is dynamic, as per below.
Big thanks
I need to amend the code so that the Row Range selection is dynamic, as per below.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.Unprotect "Password"
For Each cell In Range("B4:B18")
If cell.Value = "Expansion" Then
'NEED TO AMEND THIS LINE SO THAT THE ROW RANGE SELECTION IS DYNAMIC BASED ON THE ROW NUMBER. RANGE SAY D:F, ROW = VARIABLE.
cell.EntireRow.Locked = True
End If
Next cell
ActiveSheet.Protect "Password"
End Sub
Big thanks