Lege die Beispieldaten mit dem ersten Makro in einem leeren Sheet an, dann setzt der zweite Makro die Code um, zum Testen in Spalte B.
Sub Anlegen()
Cells(1, 1) = "rot, schwarz"
Cells(2, 1) = "blau"
Cells(3, 1) = "grün, gelb, lila"
Fa = Array("rot", "blau", "schwarz", "grün", "gelb", "lila")
Co = Array("#01#", "#02#", "#03#", "#04#", "#05#", "#06#")
Cells(1, 5).Resize(6, 2) = Application.Transpose(Array(Fa, Co))
End Sub
Sub T_1()
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
ar = Split(Cells(i, 1), ",")
For f = 0 To UBound(ar)
rr = Application.Match(Trim(ar(f)), Range("E1:E6"), 0)
ar(f) = Cells(rr, 6)
Next f
Cells(i, 2) = Join(ar, ",")
Next i
End Sub
|