Re : Macro pour comparer plusieurs données dans plusieur feuilles
j'avance sur le code mais celui ci est quelque peu bancal car il ne me compare rien dans certaine feuilles et les résultats sont erronée.
Sub CompareMontant()
Set f1 = Sheets("Feuil1")
Set f2 = Sheets("Feuil2")
Set f3 = Sheets("Feuil3")
Set f4 = Sheets("Feuil4")
Set f5 = Sheets("Feuil5")
Set f6 = Sheets("Feuil6")
Set f7 = Sheets("Feuil7")
f1.Range("W5:x10000").Sort Key1:=f1.[W5], Order1:=xlAscending, Header:=xlYes
f2.Range("W5:x10000").Sort Key1:=f2.[W5], Order1:=xlAscending, Header:=xlYes
f3.Range("W5:x10000").Sort Key1:=f3.[W5], Order1:=xlAscending, Header:=xlYes
f4.Range("W5:x10000").Sort Key1:=f4.[W5], Order1:=xlAscending, Header:=xlYes
f5.Range("W5:x10000").Sort Key1:=f5.[W5], Order1:=xlAscending, Header:=xlYes
f6.Range("W5:x10000").Sort Key1:=f6.[W5], Order1:=xlAscending, Header:=xlYes
f7.Range("W5:x10000").Sort Key1:=f7.[W5], Order1:=xlAscending, Header:=xlYes
Set a = f1.Range("W6:W" & f1.[W65000].End(xlUp).Row)
Set b = f2.Range("W6:W" & f2.[W65000].End(xlUp).Row)
Set c = f3.Range("W6:W" & f3.[W65000].End(xlUp).Row)
Set d = f4.Range("W6:W" & f4.[W65000].End(xlUp).Row)
Set e = f5.Range("W6:W" & f5.[W65000].End(xlUp).Row)
Set f = f6.Range("W6:W" & f6.[W65000].End(xlUp).Row)
Set g = f7.Range("W6:W" & f7.[W65000].End(xlUp).Row)
b.Resize(, 2).Interior.ColorIndex = xlNone
a.Resize(, 2).Interior.ColorIndex = xlNone
Set d1 = CreateObject("Scripting.Dictionary")
Set d2 = CreateObject("Scripting.Dictionary")
For Each c In a
d1(c.Value) = c.Offset(, 1).Value
Next c
For Each c In b
d2(c.Value) = c.Offset(, 1).Value
If d1.exists(c.Value) Then
If d1.Item(c.Value) <> d2.Item(c.Value) Then c.Resize(, 2).Interior.ColorIndex = 4
Else
c.Resize(, 2).Interior.ColorIndex = 3
End If