Supportnet Computer
Planet of Tech

Supportnet / Forum / Tabellenkalkulation

Fehler wenn kein INhalt





Frage

Hallo erstmal, also ich hab folgendes: Private Sub Worksheet_Change(ByVal Target As Range) If Cells(9, 2).Value < Cells(35, 2).Value Then Cells(9, 2).Interior.ColorIndex = 3 Else: Cells(9, 2).Interior.ColorIndex = 0 End If End Sub Frage: excel mekert dass ich ein else ohne if habe ??? Danke Gruß Berni

Antwort 1 von M.O.

Hallo Berni,

schreib den Code so:

Private Sub Worksheet_Change(ByVal Target As Range)

If Cells(9, 2).Value < Cells(35, 2).Value Then
Cells(9, 2).Interior.ColorIndex = 3
Else
Cells(9, 2).Interior.ColorIndex = 0

End If

End Sub


Gruß

M.O.

Antwort 2 von M.O.

Hallo Berni,

noch mal ich :-).
Oder kürzer so:

Private Sub Worksheet_Change(ByVal Target As Range)

If Cells(9, 2).Value < Cells(35, 2).Value Then Cells(9, 2).Interior.ColorIndex = 3 Else Cells(9, 2).Interior.ColorIndex = 0

End Sub


Gruß

M.O.

Antwort 3 von Berni333

Hi
Danke
klappt jetzt wunderbar
Gruß