Sub RefColor()
Application.ScreenUpdating = False
With Sheets("Feuil1")
.Range("A:B").ClearContents 'on efface les colonnes A et B
.Range("H:H").ClearContents 'ainsi que la colonne H que j'utilise pour afficher le résultat
fin = .Range("K" & .Rows.Count).End(xlUp).Row 'récupère la dernière ligne sur la colonne K
For i = 3 To fin 'pour chaque ligne
If .Range("K" & i) <> "" And .Range("J" & i) <> "" Then 'si on a un couple Ref / Couleur
.Range("A" & .Rows.Count).End(xlUp).Offset(1, 0) = .Range("J" & i) 'on le recopie en colonne A B
.Range("B" & .Rows.Count).End(xlUp).Offset(1, 0) = .Range("K" & i)
End If
Next i
Set zone = .Range("A2").CurrentRegion.Resize(, 1) 'on set la zone des couples Ref Couleur
For i = 3 To fin 'sur chaque ligne
On Error Resume Next 'une erreur intervenant lorsque la couleur n'est pas affectée à la moindre référence
If .Range("k" & i) <> "" Then .Range("H" & i) = WorksheetFunction.Index(zone, WorksheetFunction.Match(.Range("K" & i), Range("B2:B7"), 0))
Next i
End With
Application.ScreenUpdating = True
End Sub