Try:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("K:L")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="MyPassword"
Dim fnd As Range
Select Case Target.Column
Case Is = 11
If Target.Row Mod 2 = 0 Then
Set fnd = Sheets("Source").Range("C:C").Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not fnd Is Nothing Then
If fnd.Offset(, -1) <> Target.Offset(-1, -10) Then
Target.ClearContents
MsgBox ("Only " & Target.Offset(-1, -10) & " can enter a code in cell " & Target.Address(0, 0) & ".")
Else
Target.Offset(-1) = fnd.Offset(, -1)
Target.Offset(-1).Resize(2).Locked = True
End If
End If
End If
Case Is = 12
If Target.Row Mod 2 = 1 Then
Range("A" & Target.Row).Resize(, 12).Locked = True
End If
End Select
ActiveSheet.Protect Password:="MyPassword"
ActiveSheet.EnableSelection = xlUnlockedCells
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Bookmarks