Bedingte Formazierungs Code ändern
Heiko
ich hab schon wieder ein Problem. Ich hab hier einen Code von Hajo der klappt wunderbar. Jetzt müßte ich ihn aber so umstellen das wenn in den Bereichen zb. C3:C25 die Zahlen 4,5 vorkommen das sich diese Zellen dann färben. Bitte um hilfe.
Gruß Heiko
Sub Schaltfläche1_BeiKlick()
'* H. Ziplies *
'* 16.01.11 *
'* erstellt von HajoZiplies@web.de *
'* http://Hajo-Excel.de/
' Füllfarbe
' für Schrift RaZelle.Font.ColorIndex
Dim RaBereich As Range ' Variable für Bereich
Dim RaZelle As Range ' Variable für Zelle
' Bereich der Wirksamkeit
Set RaBereich = Range("A1:K1, A3:K3, A5:K5")
For Each RaZelle In RaBereich
With RaZelle
Select Case UCase(.Value) ' Umwandlung der Eingabe in Großbuchstaben
Case 1
' Füllfarbe Schwarz
.Interior.Color = 0
' Schriffarbbe weiß
.Font.Color = 16777215
' Zellenformat Standard
.NumberFormat = "General"
Case 2
.Interior.Color = 65535
.Font.ColorIndex = xlAutomatic
.NumberFormat = "General"
Case 3
.Interior.Color = 255
.Font.Color = 16777215
.NumberFormat = ";;;"
Case 4
.Interior.Color = 65280
.Font.ColorIndex = xlAutomatic
.NumberFormat = "General"
Case 5
.Interior.Color = 16711680
.Font.Color = 12632256
.NumberFormat = "General"
Case Else
.Interior.ColorIndex = xlNone
.Font.ColorIndex = xlAutomatic
.NumberFormat = "General"
End Select
End With
Next RaZelle
Set RaBereich = Nothing ' Variable leeren
End Sub
Anzeige