1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
Dim d As Range
Dim e As Range
Dim f As Range
Dim g As Range
If Target.Column = 26 And Target.Count = 1 Then
If Target.Value <> "" Then
Set c = Range("A2:R2").Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
Application.EnableEvents = False
Cells(3, c.Column) = Range("X" & Target.Row).Value
Application.EnableEvents = True
Set c = Nothing
End If
End If
End If
If Target.Column = 27 And Target.Count = 1 Then
If Target.Value <> "" Then
Set d = Range("A5:R5").Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not d Is Nothing Then
Application.EnableEvents = False
Cells(6, d.Column) = Range("X" & Target.Row).Value
Application.EnableEvents = True
Set d = Nothing
End If
End If
End If
If Target.Column = 27 And Target.Count = 1 Then
If Target.Value <> "" Then
Set e = Range("A8:R8").Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not e Is Nothing Then
Application.EnableEvents = False
Cells(9, e.Column) = Range("X" & Target.Row).Value
Application.EnableEvents = True
Set e = Nothing
End If
End If
End If
If Target.Column = 27 And Target.Count = 1 Then
If Target.Value <> "" Then
Set f = Range("A11:R11").Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not f Is Nothing Then
Application.EnableEvents = False
Cells(12, f.Column) = Range("X" & Target.Row).Value
Application.EnableEvents = True
Set f = Nothing
End If
End If
End If
If Target.Column = 28 And Target.Count = 1 Then
If Target.Value <> "" Then
Set g = Range("A14:R14").Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not g Is Nothing Then
Application.EnableEvents = False
Cells(15, g.Column) = Range("X" & Target.Row).Value
Application.EnableEvents = True
Set g = Nothing
End If
End If
End If
End Sub |
Partager