Farben
11.10.2003 09:12:38
Udo
ich habe hier ein nettes Macro zum Färben von Zeilen.
Ich möchte es aber so haben das sich die ZELLEN nach den Farben sich Einzel Einfärben wie zum Beispiel: A1 (1) = Rot Zelle A2 (2) = Blau.
Frage wer kann mir das so umschreiben das daß geht ???.
Danke für jeden Rat
Udo
Sub Hintergrundfarbe()
I = 3
Range("A" & I).Select
Do While Range("A" & I) <> ""
Range("A" & I).Select
WERT = ActiveCell
ActiveCell.Range("A1:L1").Select
Select Case WERT
Case Is = 1
With Selection.Interior
.ColorIndex = 3 'rot
.Pattern = xlSolid
End With
Case Is = 2
With Selection.Interior
.ColorIndex = 2 ' grün
.Pattern = xlSolid
End With
Case Is = 3
With Selection.Interior
.ColorIndex = 6 ' gelb
.Pattern = xlSolid
End With
Case Else
With Selection.Interior
.ColorIndex = 17 ' helblau
.Pattern = xlSolid
End With
End Select
I = I + 1
Loop
Range("A2:L" & I - 1).Select
With Selection.Borders(xlLeft)
.Weight = xlThin
.ColorIndex = 15
End With
With Selection.Borders(xlRight)
.Weight = xlThin
.ColorIndex = 15
End With
With Selection.Borders(xlTop)
.Weight = xlThin
.ColorIndex = 15
End With
With Selection.Borders(xlBottom)
.Weight = xlThin
.ColorIndex = 15
End With
Range("A" & I).Select
End Sub