online 1
gast (50)

/ Forum / Tabellenkalkulation

TabellenkalkulationTabellenkalkulation

Fragevon stoney vom 04.02.2020, 22:32 Options

Farbänderung Schrift bei Datumswechsel

Hallo,
in einer Tabelle gebe ich in Spalte A das Datum ein. Zu besseren Übersicht möchte ich bei jedem Datumwechsel die Schriftfarbe von schwarz auf rot bzw von rot auf schwarz ändern ( siehe unten)

Wie kann man so etwas hin bekommen? Habe es schon mit Bedingter Formatierung versucht, komme aber zu keinen Ergebnis.

Schon mal Danke an alle die helfen

Gruß
Christian

A1 15.11.2007 Schriftfarbe = schwarz
A2 15.11.2007 schwarz
A3 15.11.2007 schwarz

A4 16.11.2007 rot
A5 16.11.2007 rot

A6 17.11.2007 schwarz

A7 19.11.2007 rot

A8 01.12.2007 schwarz

usw.
usw.


Antwort schreiben

Antwort 1 von Marie vom 05.02.2020, 02:52 Options

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Then Exit Sub
If Target.Font.ColorIndex = 3 Then
    Target.Font.ColorIndex = 0
Else
    Target.Font.ColorIndex = 3
End If
End Sub


Hier

Gruß marie

Antwort 2 von stoney vom 05.02.2020, 10:02 Options

Hallo marie,

Danke, aber es funktioniert leider nicht so wie ich es mir vorgestellt habe.

Es kommt folgendes dabei heraus:


A1 15.11.2007 rot
A2 15.11.2007 schwarz..... soll rot
A3 15.11.2007 schwarz ..... soll rot
A4 15.11.2007 rot
A5 16.11 2007 rot ..................soll schwarz
A6 17.11 2007 rot
A7 17.11.2007 schwarz..........soll rot
A8 18.11.2007 schwarz.
A9 18.11.2007 schwarz
A10 18.11.2007 rot..................soll schwarz


Die Farben ändern sich im 3er Rytmus und nicht wie gewünscht bei jeder Datumsänderung. So lange sich Das Datum nicht ändert, soll sich die Schriftfarbe auch nicht ändern.
Vielleicht hast Du ja noch eine Idee....

Gruß
Christian

Antwort 3 von rainberg vom 05.02.2020, 12:41 Options

Hallo Christian,

probier mal das

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.Column <> 1 Then Exit Sub
   If Target.Value = Target.Offset(-1, 0).Value Then
      If Target.Offset(-1, 0).Font.ColorIndex = 3 Then Target.Font.ColorIndex = 3
      If Target.Offset(-1, 0).Font.ColorIndex = -4105 Then Target.Font.ColorIndex = -4105
   End If
   If Target.Value <> Target.Offset(-1, 0).Value Then
      If Target.Offset(-1, 0).Font.ColorIndex = 3 Then Target.Font.ColorIndex = -4105
      If Target.Offset(-1, 0).Font.ColorIndex = -4105 Then Target.Font.ColorIndex = 3
   End If
End Sub



Gruß
Rainer

Antwort 4 von woher vom 05.02.2020, 14:49 Options

Hallo,
wozu VBA?
nimm das bedingte Format:
Formel ist ; =REST(A1;2)=0
mfg
Wolfgang W.

Antwort 5 von stoney vom 05.02.2020, 15:41 Options

Danke Rainer, Danke Wolfgang W. .....

beide Lösungen funktionieren.

SUPER SUPER

Gruß
Christian

Ähnliche Themen

Griechische Schrift
Uesch  28.06.2007 - 155 Hits -

Photoshop CS3 - Spiegelverkehrte Schrift
hardDriveMonster  23.09.2007 - 72 Hits - 2 Antworten

Schrift vergrößern
Ofra  29.09.2007 - 162 Hits - 2 Antworten

Windows XP mit Outlock
ewebmw  28.11.2007 - 93 Hits - 2 Antworten

Neue Schrift installieren?
WITA  19.01.2008 - 145 Hits - 5 Antworten

Hinweis

Diese Frage ist schon etwas älter, Sie können daher nicht mehr auf sie antworten. Sollte Ihre Frage noch nicht gelöst sein, stellen Sie einfach eine neue Frage im Forum..

Neue Einträge

Version: supportware 1.9.150 / 10.06.2022, Startzeit:Thu Jan 8 21:07:44 2026