Hello. I have the VBA code below. What it does is check if the data entered in a cell in column R is valid and then lock the cell and cells on the row from columns A to Q. What I am after is a better/more efficient for the condition "If Target = "123456" Or Target = "3245671" Or Target = "4227716" Then" as there are up to 20 different set of numbers I want to validate else I will have a very long If Or statement. Thanks
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("R:R")) Is Nothing Then Exit Sub
ActiveSheet.Unprotect Password:="mypassword"
If Target = "123456" Or Target = "3245671" Or Target = "4227716" Then
Range("A" & Target.Row & ":R" & Target.Row).Locked = True
End If
ActiveSheet.Protect Password:="1855nom"
End Sub