Ich habe hier ein wirklich kleines Problem, aber ich komme nicht darauf wie ich es löse.
Dies hier ist mein VBA, welches die Farben von Zeilen ändern soll (wenn zum beispiel in Spalte14 Topic steht soll alles auf die Farbe wechseln, die in (2,3) angegeben ist.
Set WS = Sheets("Para") 'Blatt "Para" wird mit "WS" abgekürzt
For i = 2 To 11
If Cells(Target.Row, 14).Value = WS.Cells(i, 2) Then 'Topic
RGBColInt = Split(WS.Cells(i, 3).Value, ",")
RGBColFont = Split(WS.Cells(i, 11).Value, ",")
If UBound(RGBColInt) = 2 And UBound(RGBColFont) = 2 Then
With Range(Cells(Target.Row, 1), Cells(Target.Row, 18))
.Interior.Color = RGB(RGBColInt(0), RGBColInt(1), RGBColInt(2))
.Font.Bold = True
.Font.Color = RGB(RGBColFont(0), RGBColFont(1), RGBColFont(2))
End With
End If
Cells(Target.Row, 1).Font.ColorIndex = 1
Cells(Target.Row, 1).NumberFormat = "000"
Cells(Target.Row, 1).HorizontalAlignment = xlLeft
Cells(Target.Row, 2).Font.ColorIndex = 15
Cells(Target.Row, 2).NumberFormat = "000,000"
Cells(Target.Row, 2).HorizontalAlignment = xlLeft
Cells(Target.Row, 8).NumberFormat = "m/d/yyyy"
Cells(Target.Row, 9).NumberFormat = "m/d/yyyy"
Cells(Target.Row, 10).NumberFormat = "m/d/yyyy"
End If
Next i
Die formel funktioniert bei Topic also i=2 ganz automatisch.
Bei i=3 bis 11 funktioniert es nur wenn ich das wort in Spalte 14 neu eingebe. --> es sollte aber wie bei i=2 sich direkt verfärben.