Halludu,
es ist immer problematisch, wenn Code den du offensichtlich nicht abkannst auf vereinfachtem Beispiel aufschlägt.
Sub TestIt()
Dim arrListe() As Variant, x As Long, c As Range
arrListe = Sheets("Liste").UsedRange.Value
With Sheets("Matrix")
For x = 2 To UBound(arrListe, 1)
On Error Resume Next
arrListe(x, 2) = .Rows(2).Find(arrListe(x, 2), , xlValues, xlWhole).Offset(-1).Interior.ColorIndex
arrListe(x, 3) = .Rows(2).Find(arrListe(x, 3), , xlValues).Column
arrListe(x, 4) = Err.Number
On Error GoTo 0
Next x
For x = 2 To UBound(arrListe, 1)
If arrListe(x, 4) = 0 Then
Set c = .Columns(2).Find(arrListe(x, 1), , xlValues, xlWhole)
If c Is Nothing Then
Set c = .Columns(2).Cells(.Rows.Count).End(xlUp).Offset(1)
c.Value = arrListe(x, 1)
End If
c.Offset(, arrListe(x, 3) - 2).Interior.ColorIndex = arrListe(x, 2)
End If
Next x
End With
End Sub
|