https://bugs.documentfoundation.org/show_bug.cgi?id=164462
Bug ID: 164462
Summary: Calc/Basic Strange Bug in setting conditional
formatting from a macro: Calc miscalculating a
reference
Product: LibreOffice
Version: 24.8.3.2 release
Hardware: x86-64 (AMD64)
OS: Windows (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: BASIC
Assignee: [email protected]
Reporter: [email protected]
Steps to reproduce:
1. Enter any values in first row starting from cell AA1, AB1, AC1... and
randomly skip some cells.
2. We will use conditional formatting to color a range of cells below first row
starting at AA2, ie. AA2:AF10. We want to color given range columns if cell in
first row is not empty with formula: NOT(ISBLANK(AA$1).
3. Open Macros (Tools->Macros>Edit Macros); Create Module (Tools->Select
Module...): In Basic Macro Organizer select document and Create New Module
4. Paste folowing Macro and Run:
Option VBASupport 1
Sub ConditionalFormatSet
Dim oSheet: oSheet =
ThisComponent.CurrentController.ActiveSheet
Dim oRange: oRange = oSheet.getCellRangeByName("AA2:AF10")
Dim oFormat: oFormat =
oRange.getPropertyValue("ConditionalFormat")
Dim oCondition(3) As New com.sun.star.beans.PropertyValue
oCondition(0).Name = "Operator"
oCondition(0).Value = com.sun.star.sheet.ConditionOperator.FORMULA
oCondition(1).Name = "Formula1"
oCondition(1).Value = "NOT(ISBLANK(AA$1))"
oCondition(2).Name = "StyleName"
oCondition(2).Value = "Bad"
oFormat.addNew(oCondition)
oRange.setPropertyValue("ConditionalFormat", oFormat)
End Sub
5. Open Manage Conditional Formatting in Calc (Format->Conditional->Manage)
6. Your formula is now changed to "NOT(ISBLANK(BA$1)"
Why is User formula reference cell changed?
--
You are receiving this mail because:
You are the assignee for the bug.