Prevent array of formulas from populating range of cells as text (' prefix)

Setting a range of cells from an array of formulas prefixes them with ’ making them text.
How can the ’ text prefixing be prevented?
Don’t want to do them one at a time with .setFormula()

Dim arrChgPctChg(1 to Rows_Count - 1, 1 to 2)
For row_index = 2 To Rows_Count
    arrChgPctChg(row_index - 1, 1) = "=$G" & row_index & "-$G" & row_index + 1
    arrChgPctChg(row_index - 1, 2) = "=$H" & row_index & "/$G" & row_index + 1
Next
.getCellRangeByName("H2:I" & UBound(arrChgPctChg())+1).setDataArray(arrChgPctChg())

LibreOffice 7.5.1.2

.setDataArray? Why not .setFormulaArray?

By the way, don’t you think that the array and the loop are superfluous here?

	.getCellRangeByName("H2").setFormula("=$G2-$G3")
	.getCellRangeByName("I2").setFormula("=$H2/$G3")
	.getCellRangeByName("H2:I" & Rows_Count).fillAuto(com.sun.star.sheet.FillDirection.TO_BOTTOM, 1)

is a little easier to read and understand

1 Like

So glad there are experts like you willing to help out hacks like me.
Both of your answers solve the issue. Of course, you already knew that.

Had danced all around that .setFormulaArray with things like .setDataFormula etc.
.fillAuto is the way to go though.

Thank you very much.