Hi- I am looking for a VBA code that will lock a range of cells (D6:F6) when the value in cell B6="Submit". I want this to continue down to row 250 (so if cell B16="Submit" then cells D16:F:16 will then lock). My sheet has a password, right now it is "Test". I also need the cells in column B to lock once a cell is marked "Submit". I have the code below that locks the B column cells but I have no idea how to combine that with other VBA code.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Range("B6:B250")
ActiveSheet.Unprotect Password:="Test"
For Each cell In rng
If cell.Value <> "" Then
cell.Locked = True
End If
Next
ActiveSheet.Protect Password:="Test"
End Sub
Any help would be so appeciated for this newbie!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Range("B6:B250")
ActiveSheet.Unprotect Password:="Test"
For Each cell In rng
If cell.Value <> "" Then
cell.Locked = True
End If
Next
ActiveSheet.Protect Password:="Test"
End Sub
Any help would be so appeciated for this newbie!