ich habe aus dem Forum einen Code, den ich angepasst habe. Danach wird in den
Zellen E4:E74 der Farbhintergrund angepasst, je nachdem welche Zahl in der Zelle
steht; z. B. 1 = ROT
Ausgelöst wird dies immer wenn ich in A1 klicke.
Da die Zellen E4:E74 Formeln enthalten, hätte ich gerne, dass sich der Farb-
hintergrund bereits ändert, wenn sich das Ergebnis der Formel geändert hat;
z.B. durch Berechnen F9 - geht so was? Hier der Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim gezogen As Range, zeile As Long, Zelle As Range
Dim tip1 As Range, tip2 As Range, tip3 As Range, tip4 As Range, tip5 As Range
Dim tip6 As Range, tip7 As Range, tip8 As Range, tip9 As Range, tip10 As Range
On Error Resume Next
If Target.Count > 1 Or Target.Row > 1 Or Target.Column <> 1 Then Exit Sub
gezogen.Interior.ColorIndex = xlNone
zeile = Target.Row
Set tip1 = Cells(29, 30)
Set tip2 = Cells(30, 30)
Set tip3 = Cells(31, 30)
Set tip4 = Cells(32, 30)
Set tip5 = Cells(33, 30)
Set tip6 = Cells(34, 30)
Set tip7 = Cells(35, 30)
Set tip8 = Cells(36, 30)
Set tip9 = Cells(37, 30)
Set gezogen = Range(Cells(4, 5), Cells(74, 5))
For Each Zelle In gezogen
If WorksheetFunction.CountIf(tip1, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = 3
If WorksheetFunction.CountIf(tip2, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = 22
If WorksheetFunction.CountIf(tip3, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = 40
If WorksheetFunction.CountIf(tip4, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = xlNone
If WorksheetFunction.CountIf(tip5, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = xlNone
If WorksheetFunction.CountIf(tip6, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = xlNone
If WorksheetFunction.CountIf(tip7, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = 43
If WorksheetFunction.CountIf(tip8, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = 10
If WorksheetFunction.CountIf(tip9, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = 4
Next
End Sub
Besten Dank für eine Hilfe!
mfg
Erich
EXCEL-Shareware und Freeware: http://www.toolex.de
Private Tippgemeinschaft für Lotto oder KENO: http://www.kenostrategen.de