Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
296to300
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
296to300
296to300
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Ampelkonto / Bedingte Fromatierung

Ampelkonto / Bedingte Fromatierung
24.08.2003 13:28:30
Erich M.
Hallo zusammen,
hallo Hajo,
meine Versuche einen Code von Hajo abzuändern sind leider gescheitert,
weshalb ich Hilfe benötige.
Für die Darstellung eines Ampelkontos (Arbeits-Zeitguthaben in verschiedenen
Größen) benötige ich eine Bedingte Formatierung, für die ich den Code von
Hajo verwende:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim RaBereich As Range, RaZelle As Range, RaBereich2 As Range
Set RaBereich = Range("b2:G50")
For Each RaZelle In Range(Target.Address)
If Not Intersect(RaZelle, RaBereich) Is Nothing Then
Select Case RaZelle.Value
Case -50 To 0, 1
RaZelle.Font.ColorIndex = 15
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Case 0, 1 To 20
RaZelle.Font.ColorIndex = 3
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Case 20, 1 To 50
RaZelle.Font.ColorIndex = 5
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Case 50, 1 To 200
RaZelle.Font.ColorIndex = 9
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Case 201 To 500
RaZelle.Font.ColorIndex = 7
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Case Else
RaZelle.Font.ColorIndex = 0
End Select
End If
Next RaZelle
Set RaBereich = Nothing
End Sub


Code eingefügt mit: Excel Code Jeanie
Soweit kein Problem. Jetzt muss ich aber erreichen, dass in
Abhängigkeit in Vollzeit (VZ) oder Teilzeit (TZ) das Guthaben
mit einer unterschiedlichen Formatierung erscheint. Sämtliche
Versuche mit IF oder "RaBereich2" zu erstellen sind gescheitert.
Wer hat eine Idee, nachstehend ein Tabellenausschnitt:

7
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Ampelkonto / Bedingte Fromatierung
24.08.2003 13:36:58
Hajo_Zi
Hallo Erich
ich sehe noch keinen Ansatz, da mir das Problem nicht klar ist.
Warum beginnt RaBereich bei B2 und nicht bei C2??
Erkläre doch mal was du mit den Farben darstellen möchtest, getrennt nach VZ und TZ
zb. Tz 10 Rot VZ 10 Grün usw.
Falls Code vorhanden wurde dieser getestet unter Betriebssystem XP Pro und Excel Version XP SBE.
Bitte kein Mail, Probleme sollen im Forum gelöst werden.
Microsoft MVP für Excel
Das Forum lebt auch von den Rückmeldungen.
Zurzeit gibt es wieder Probleme mit der E-Mail Benachrichtigung.
Ich bekomme Mails zu Beiträgen an denen ich nicht beteiligt bin und zusätzlich noch Mails zu meinen eigenen Beiträgen.
Das Problem mit den eigenen Benachrichtigung kann gelöst werden durch Lösche und Neuanmelden. Dieses möchte ich aber nicht jeden Tag machen.
Um dieses Problem erstmal zu beseitigen habe ich die automatische Mailbenachrichtigung abgeschaltet.
Aus diesem Grunde ist es dem Zufall überlassen ob auf Rückfragen Antworten von mir kommen.

Anzeige
AW: Ampelkonto / Bedingte Fromatierung
24.08.2003 13:55:14
Erich M.
Hallo Hajo,
RaBereich muss natürlich bei C2 beginnen; hatte nachträglich
Spalte A eingefügt und vergessen, den Code anzupassen.
Farben:
AW: Ampelkonto / Bedingte Fromatierung
24.08.2003 14:15:56
Hajo_Zi
Hallo Erich
das ist mir nun zu Aufwendig die ganzen bedingungen zu erstellen.
ersetze in deinem Code das Kommo duch punkt (20,01 in 20.01)
Case 0.1 To 10.9
If Cells(RaZelle.Row, 2) = "VZ" Then
RaZelle.Font.ColorIndex = 3
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Else
RaZelle.Font.ColorIndex = 3
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
End If
einige Bedingungen hatte ich schon erstellt.
Anzeige
Ergänzung
24.08.2003 14:24:59
Hajo_Zi
Hallo Erich
ich vermute mal es müßte
Private Sub Worksheet_Change(ByVal Target As Range)
sein.
Falls Code vorhanden wurde dieser getestet unter Betriebssystem XP Pro und Excel Version XP SBE.
Bitte kein Mail, Probleme sollen im Forum gelöst werden.
Microsoft MVP für Excel
Das Forum lebt auch von den Rückmeldungen.

AW: Ergänzung
24.08.2003 14:50:52
Erich M.
Hallo Hajo,
sehr gut aufgepasst!
Hatte mich immer gewundert, warum ich noch "selektieren" musste
für die Änderung.
Jetzt passt es ganz genau!!
Vielen Dank nochmals!!
mfg
Erich

Anzeige
Danke für die Rückmeldung oT
24.08.2003 14:52:57
Hajo_Zi
Geschafft ! AW: Ampelkonto / Bedingte Fromatierung
24.08.2003 14:48:02
Erich M.
Hallo Hajo,
besten Dank für den Tipp! War genau das was ich gesucht habe.
Die Lösung (auch fürs Archiv):

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim RaBereich As Range, RaZelle As Range, RaBereich2 As Range
Set RaBereich = Range("b2:G50")
For Each RaZelle In Range(Target.Address)
If Not Intersect(RaZelle, RaBereich) Is Nothing Then
Select Case RaZelle.Value
Case -50 To 0.1
If Cells(RaZelle.Row, 2) = "VZ" Then
RaZelle.Font.ColorIndex = 15
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Else
RaZelle.Font.ColorIndex = 15
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
End If
Case 0.11 To 10
If Cells(RaZelle.Row, 2) = "VZ" Then
RaZelle.Font.ColorIndex = 3
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Else
RaZelle.Font.ColorIndex = 3
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
End If
Case 10.01 To 20
If Cells(RaZelle.Row, 2) = "VZ" Then
RaZelle.Font.ColorIndex = 3
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Else
RaZelle.Font.ColorIndex = 5
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
End If
Case 20.01 To 25
If Cells(RaZelle.Row, 2) = "VZ" Then
RaZelle.Font.ColorIndex = 5
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Else
RaZelle.Font.ColorIndex = 5
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
End If
Case 25.01 To 50
If Cells(RaZelle.Row, 2) = "VZ" Then
RaZelle.Font.ColorIndex = 5
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Else
RaZelle.Font.ColorIndex = 9
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
End If
Case 50.01 To 200
If Cells(RaZelle.Row, 2) = "VZ" Then
RaZelle.Font.ColorIndex = 9
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Else
RaZelle.Font.ColorIndex = 9
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
End If
Case 200.01 To 500
If Cells(RaZelle.Row, 2) = "VZ" Then
RaZelle.Font.ColorIndex = 7
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
Else
RaZelle.Font.ColorIndex = 7
RaZelle.Font.FontStyle = "Fett"
RaZelle.Font.Size = 14
End If
Case Else
RaZelle.Font.ColorIndex = 0
End Select
End If
Next RaZelle
Set RaBereich = Nothing
End Sub


Code eingefügt mit: Excel Code Jeanie
mfg
Erich

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige