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
| Sub integration()
Worksheets("Feuil1").Activate
Worksheets("Feuil3").Activate
Dim i As Long
Dim j As Long
Application.ScreenUpdating = False
For i = 2 To 49000 'tous les produits avec l'historique
For j = 5 To 10000 'tous les produits du fichier de prevs
Sheets("Feuil3").Select
If (Range("A" & i).Value <> Range("A" & (i + 6)).Value) Then 'on regarde quand on change de produit pour avoir des cases vides
If Worksheets("Feuil3").Range("A" & i).Value = Worksheets("Feuil1").Range("A" & j).Value Then 'on récupère la bonne référence dans l'autre produit
Range("R" & (i + 5), "R" & (i + 10)).Select 'on copie-colle
Selection.Copy
Sheets("Feuil1").Select
Range("AO" & j, "AO" & j + 6).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
i = i + 6 'on passe au prochain article
End If
End If
Next
Next
Application.ScreenUpdating = True
End Sub |
Partager