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
| Sub MAJ()
Dim Plage As Variant, Ligne As Long, Plage1 As Variant, C As Range, Plg As Range
With Sheets("Feuil1")
Plage = .Range("B2", .Cells(.Rows.Count, 2).End(xlUp)).Resize(, 12)
Set Plg = .Range("B2", .Cells(.Rows.Count, 2).End(xlUp)).Resize(, 12)
End With
With Sheets("Feuil2")
Plage1 = .Range("B2", .Cells(.Rows.Count, 2).End(xlUp)).Resize(, 7)
For i = 1 To UBound(Plage, 1)
For j = 1 To UBound(Plage1, 1)
If Plg(i, 1).Interior.ColorIndex <> xlNone Then
If Plage(i, 1) = Plage1(j, 1) And _
Plage(i, 7) = Plage1(j, 7) Then
Sheets("Feuil1").Rows(i + 1).Copy .Cells(j + 1, 1)
ElseIf Plage(i, 1) = Plage1(j, 1) Then
Ligne = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
Sheets("Feuil1").Rows(i + 1).Copy .Cells(Ligne, 1)
End If
Else
Exit For
End If
Next j
Next i
End With
End Sub |
Partager