AW: andere zelle färben mit vba
09.10.2008 19:13:00
Frank
Hallo Hary
Ich habe diesen
Private Sub Worksheet_Change(ByVal Target As Range)
Dim RaBereich As Range, RaZelle As Range
' Bereich der Wirksamkeit
Set RaBereich = Range("d10:ah10")
Set RaBereich = Intersect(RaBereich, Range(Target.Address))
If RaBereich Is Nothing Then Exit Sub
For Each RaZelle In RaBereich
With Range(RaZelle.Address, RaZelle.Offset(1, 0).Address)
Select Case UCase(RaZelle.Value) ' UMWANDLUNG DER Eingabe in Großbuchstaben
Case "F"
' rot
.Interior.ColorIndex = 3
'.Font.ColorIndex = 0
' Schriftfarbe automatisch
'.NumberFormat = "General"
' Zellenformat Standard
Case "N"
' gelb
.Interior.ColorIndex = 6
'.Font.ColorIndex = 0
' Schriftfarbe automatisch
'.NumberFormat = "General"
' Zellenformat Standard
Case Is > 3
' grün
.Interior.ColorIndex = 4
'.Font.ColorIndex = 0
' Schriftfarbe Weiß
'.NumberFormat = ";;;"
' nicht sichtbar
Case Else
' Keine
.Interior.ColorIndex = xlNone
'.Font.ColorIndex = 0
' Schriftfarbe automatisch
'.NumberFormat = "General"
' Zellenformat Standard
End Select
End With
Next RaZelle
' ActiveSheet.protect ("Passwort")
Set RaBereich = Nothing
End Sub
Der geht ja aber nur bei direkter eingabe, er soll die farbe aber ändern sobal sich der wert ändert, auch ohne direkter eingabe.
aber schon mal danke für die super schnelle antwort
Frank