I’m trying to write a formula into a series of cells. The formula is the same each time – the sum of a column of cells – except that the column number differs each time.
Here is my code (excluding some dim definitions in previous blocks):
Dim ColChar as string
Dim RangeFormula as string
For BColumnNum = BEndColumn to BEndColumn-8 step -1
ColChar=CHR(ColumnNum-64)
RangeFormula=""=sum("&ColChar&“4:”&ColChar&BEndRow+2")""
BufferCell=AssetSheet.getCellByPosition(ColumnNum,BEndRow+2)
BufferCell.setFormula(RangeFormula)
Next BColumnNum
This generates: “BASIC syntax error. Parentheses do not match.”
In the IDE code window, the =sum( part is in green whereas everything else between the first and last quotation marks is in red (ie as if the =sum( is an instruction rather than a string.
Would appreciate help on how to do this.