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
| Private Sub CommandButton1_Click()
Dim PlSource As Range
Dim DerLig As Long, i As Long, LigDest As Long
With Worksheets("recup")
DerLig = .Range("A65536").End(xlUp).Row
Set PlSource = .Range(.Cells(2, 1), .Cells(DerLig, 1))
For Each c In PlSource
If c.Value = "AAA" Then
i = c.Row
Worksheets("suivi").Cells(1, 4).Value = .Cells(i, 3).Value
Worksheets("suivi").Cells(1, 7).Value = .Cells(i, 2).Value
End If
If c.Value = "BBB" Or c.Value = "CCC" Then
i = c.Row
LigDest = Worksheets("suivi").Range("A65536").End(xlUp).Row + 1
Worksheets("suivi").Cells(LigDest, 1).Value = c.Value
Worksheets("suivi").Cells(LigDest, 2).Value = .Cells(i, 2).Value
Worksheets("suivi").Cells(LigDest, 3).Value = .Cells(i, 4).Value
For k = 6 To 10
Worksheets("suivi").Cells(LigDest, k - 2) = .Cells(i, k).Value
Next k
End If
Next c
End With
End Sub |
Partager