1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
Sub DoublonsEntre2Colonnes()
Set d = CreateObject("Scripting.Dictionary")
couleurs = Array(3, 4, 6, 7, 8, 15, 17, 20, 22, 24, 26, 27, 28, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 50, 53)
Set plage1 = Range("A2:A" & [a65000].End(xlUp).Row)
Set plage2 = Range("B2:B" & [b65000].End(xlUp).Row)
Union(plage1, plage2).Interior.ColorIndex = xlNone
For Each C In plage1
d.Item(C.Value) = d.Item(C.Value) & C.Row & "-"
Next C
For Each C In plage2
If d.exists(C.Value) Then
nocoul = (Application.Match(C.Value, d.keys, 0)) Mod UBound(couleurs)
C.Interior.ColorIndex = couleurs(nocoul)
a = Split(d.Item(C.Value), "-")
For k = LBound(a) To UBound(a) - 1
tmp = a(k) - plage1.Row + 1
plage1(tmp).Interior.ColorIndex = couleurs(nocoul)
Next k
End If
Next C
End Sub |
Partager