tabbytomo
New Member
- Joined
- Jun 23, 2016
- Messages
- 18
Hi everyone! I've hit a bit of a brick wall with my knowledge and could do with a hand. I've got a simple sheet, I need cells A2 - D2 filling in, then once there is content in that range, lock that range AND unlock the row below (A3 - D3).
So far, I've managed to get it to lock the entire sheet when there is content in the range, and this applies no matter how many rows you complete, so for example I could get all the way down to A20 - D20 and this code would work. I'm looking for some help with that final bit, keep the row below unlocked as that will be the next set of cells we want data to go into.
Any ideas?
Current code:
So far, I've managed to get it to lock the entire sheet when there is content in the range, and this applies no matter how many rows you complete, so for example I could get all the way down to A20 - D20 and this code would work. I'm looking for some help with that final bit, keep the row below unlocked as that will be the next set of cells we want data to go into.
Any ideas?
Current code:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Const PASSWORD = "PASSWORD"
Dim Row As Long
If Target.Column = 4 Then
Target.Parent.Unprotect PASSWORD
Row = Target.Row
Target.Parent.Range("A" & Row & ":" & "D" & Row).Locked = True
Target.Parent.Protect PASSWORD
End If
End Sub