trotz Dannenhöfer will mir das Makro nicht gelingen.
Für Zellen C42 und G42
1. Bed.: kleiner als 120
2. Bed.: zwischen 120 und 139
3. Bed.: größer gleich 141
2 Probleme
1. die 2. Bedingung wird nicht ausgeführt
2. der Code wird nur in Zelle C42, nicht in G42 ausgeführt
Würde mich freuen, wenn Ihr mir da weiterhelfen könntet.
Vielen Dank
Code: Alles auswählen
Sub EinfuegenConditionalFormCell
Dim oCell as Object
Dim oConditionalForm as Object
oCell = ThisComponent.Sheets(9).getCellRangeByName("C42","G42")
oConditionalForm = oCell.ConditionalFormat
Dim oCondition(3) as New com.sun.star.beans.PropertyValue
oCondition(0).Name = "Operator"
oCondition(0).Value = com.sun.star.sheet.ConditionOperator.LESS
oCondition(1).Name = "Formula1"
oCondition(1).Value = "120"
oCondition(2).Name = "StyleName"
oCondition(2).Value = "warnGELB"
oConditionalForm.addNew( oCondition() )
oCondition(0).Value = com.sun.star.sheet.ConditionOperator.BETWEEN
oCondition(1).Name = "Formula1"
oCondition(1).Value = "120"
oCondition(1).Name = "Formula2"
oCondition(1).Value = "139"
oCondition(2).Name = "StyleName"
oCondition(2).Value = "warnGRÜN"
oCondition(0).Value = com.sun.star.sheet.ConditionOperator.GREATER_EQUAL
oCondition(1).Name = "Formula1"
oCondition(1).Value = "141"
oCondition(2).Name = "StyleName"
oCondition(2).Value = "warnROT"
oConditionalForm.addNew( oCondition() )
oCell.ConditionalFormat = oConditionalForm
End Sub