Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenTue, 05 Dec 2017 23:36:46 +0100Set a formula from macro basic using countif and regular expressionhttps://ask.libreoffice.org/en/question/139946/set-a-formula-from-macro-basic-using-countif-and-regular-expression/Hi. If I run the following sub against a blank sheet I get Err 508 in cell A4. Clicking on the cell gives the text of the formula, clicking the tick or hitting enter the error remains. Type a additional space at the end of the formula and hit enter the formula works (giving a result of zero!)
Using the same code to populate the cell with a more basic formula (=A1 as in the second line) works first time without the need to add an additional space. What am I doing wrong?
Subroutine
Sub test3
ThisComponent.Sheets(1).getCellByPosition(0,3).setFormula("=COUNTIF(A1:A2, "".*X.*"")")
ThisComponent.Sheets(1).getCellByPosition(0,4).setFormula("=A1")
end Sub
(Edited a bit for better readability by @Lupp)WaiwurrieTue, 05 Dec 2017 23:36:46 +0100https://ask.libreoffice.org/en/question/139946/