Bonjour,
Je recherche un solution à mon problème.
Je dois comparer 2 cellules de 2 onglets du même fichier et si égale ajouter une ligne et copier différente cellule.
En lançant la macro, celle-ci bug à la comparaison, voivi le code :
Sub report()
'tableau mp
Dim a As Long
Dim b As Long
Dim i As Long
a = 1
Do
a = a + 1
b = 2
For i = 2 To 95000
If EQUIP!Range("D" & b).Value = Marteau!Range("D" & a).Value Then
Marteau!Rows("a;a").Select
Selection.Copy
Marteau!Rows("a:a").Select
Selection.Insert Shift:=xlDown
Sheets("EQUIP").Select
Range("B" & b).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("MARTEAU").Select
Range("B" & a).Select
ActiveSheet.Paste
Sheets("EQUIP").Select
Range("J" & b).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("MARTEAU").Select
Range("J" & b).Select
ActiveSheet.Paste
Else
b = b + 1
End If
Next i
Quelqu'un pourrait-il regarder mon code et me dire ou est mon erreur.
Merci d'avance.
Lionel
Je recherche un solution à mon problème.
Je dois comparer 2 cellules de 2 onglets du même fichier et si égale ajouter une ligne et copier différente cellule.
En lançant la macro, celle-ci bug à la comparaison, voivi le code :
Sub report()
'tableau mp
Dim a As Long
Dim b As Long
Dim i As Long
a = 1
Do
a = a + 1
b = 2
For i = 2 To 95000
If EQUIP!Range("D" & b).Value = Marteau!Range("D" & a).Value Then
Marteau!Rows("a;a").Select
Selection.Copy
Marteau!Rows("a:a").Select
Selection.Insert Shift:=xlDown
Sheets("EQUIP").Select
Range("B" & b).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("MARTEAU").Select
Range("B" & a).Select
ActiveSheet.Paste
Sheets("EQUIP").Select
Range("J" & b).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("MARTEAU").Select
Range("J" & b).Select
ActiveSheet.Paste
Else
b = b + 1
End If
Next i
Quelqu'un pourrait-il regarder mon code et me dire ou est mon erreur.
Merci d'avance.
Lionel