Hi Leute
wie kann ich heraus bekommen welche Bedingte Formatierung angewendet wird und das per Macro?
Also ich habe 3 Bedingungen
1) istGleich 0 weiß
2) D9>D8 grün
3) D9<D8 rot
Jetzt möchte ich abfragen ob D9 rot ist. Mit ConditionalFormat komme ich nicht weiter, das auflisten der Bedingungen ist nicht das was ich suche.
Ich hoffe es kann mir jemand helfen.
Gruß navy-cis
Bedingte Formatierung
Moderator: Moderatoren
Re: Bedingte Formatierung
Hallo
Was hälst du von einem pragmatischem:
(Achtung Pseudocode)
if D9 < D8 then
zustand = "rot"
end if
if D9 > D8 then
zustand = "grün"
end if
...
Gruß Karo
Was hälst du von einem pragmatischem:
(Achtung Pseudocode)
if D9 < D8 then
zustand = "rot"
end if
if D9 > D8 then
zustand = "grün"
end if
...
Gruß Karo
LO7.4.7.2 debian 12(bookworm) auf Raspberry4b 8GB (64bit)
LO24.8.2.1 flatpak debian 12(bookworm) auf Raspberry4b 8GB (64bit)
LO24.8.2.1 flatpak debian 12(bookworm) auf Raspberry4b 8GB (64bit)
Re: Bedingte Formatierung
Hi Karo
vielen Dank für die schnelle Antwort, leider ist dein Vorschlag nicht das was ich suche.
Das Beispiel das ich benutzt habe ist nur eine Zelle ich. In meinem Prog. frage ich 20 Zellen ab.
Ich hatte da er an so etwas gedacht.
ich würde gerne den StyleName abfragen. Damit ich das ganze in einer Schleife laufen lassen kann.
Gruß navy-cis
vielen Dank für die schnelle Antwort, leider ist dein Vorschlag nicht das was ich suche.
Das Beispiel das ich benutzt habe ist nur eine Zelle ich. In meinem Prog. frage ich 20 Zellen ab.
Ich hatte da er an so etwas gedacht.
Code: Alles auswählen
Sub bedingteFormateEinerZelleAnzeigen
' Variablen deklarieren
Dim oZelle as Object
Dim oBedingtesFormat as Object
Dim nCounter as Integer
Dim sAusgabe as String
' Zelle A1 holen
oZelle = ThisComponent.Sheets(2).getCellByPosition( 5, 8 )
' Schleife durch alle bedingten Formate
For nCounter = 0 To oZelle.ConditionalFormat.Count-1
' bedingtes Formate holen
oBedingtesFormat = oZelle.ConditionalFormat(nCounter)
' Ausgabe der Eigenschaften
sAusgabe = (nCounter+1) & ". Bedingtes Format:" & chr(13)
sAusgabe = sAusgabe & "Operator: " & _
oBedingtesFormat.Operator & chr(13)
sAusgabe = sAusgabe & "Formel 1: " & _
oBedingtesFormat.Formula1 & chr(13)
sAusgabe = sAusgabe & "Formel 2: " & _
oBedingtesFormat.Formula2 & chr(13)
sAusgabe = sAusgabe & "Formatvorlage: " & _
oBedingtesFormat.StyleName & chr(13)
' Ausgabe anzeigen
MsgBox sAusgabe
Next nCounter
End Sub
Gruß navy-cis
LG n-cis