1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range, Plage As Range
Dim Nb As Integer
If Target(1, 1).Address(0, 0) = "B9" Then
Range("F9:" & Range("F9").End(xlToRight).Address).ClearContents
If Target(1, 1).Value <> "" Then
With Sheets("plan entrepot")
Set c = .Columns(1).Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
Set Plage = .Range("D" & c.Row & ":K" & c.Row)
Plage.Copy Cells(9, 6)
Do While c.Offset(1, 0).Value = "" And c.Offset(0, 3).Address <> .Cells(Rows.Count, "D").End(xlUp).Address
Set c = c.Offset(1, 0)
Nb = .Range("L" & c.Row).End(xlToLeft).Column
Set Plage = .Range(.Cells(c.Row, 4), .Cells(c.Row, Nb))
Plage.Copy Cells(9, Cells(9, Columns.Count).End(xlToLeft).Column + 1)
Loop
End If
Set c = Nothing
End With
End If
End If
End Sub |
Partager