Macro to unlock a selection of cells in a row based on the value in a specific cell of that row

17 Views Asked by At

I need a macro to unlock a selection of cells within a row based on a specific value "0" in the first cell of the selection. The macro needs to run on all rows starting with the value "0".

I found the following macro, but it does not address the multiple rows issue.

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B20") = "0" Then
    Range("B21:E21").Locked = False
ElseIf Range("A1") = <> 0 Then
    Range("B21:E21").Locked = True
End If

End Sub
0

There are 0 best solutions below