Someone else's code in the project, that I am trying to fix up.
listO.Range(i, j).FormulaR1C1 = FormulaMatrix(i, j)
where FormulaMatrix(i, j)
is always a String
value. Whatever random/test value, I try with, is being assigned successfully, except when it is a formula, eg.
=IF(LENGTH([@Units])>0;[@SalesAmount]-[@DiscountAmount]0)
If I remove the =
sign in the beginning of the formula, it gets assigned correctly, but then it's useless, because it's not a formula.
@Units
, @SalesAmount
, @DiscountAmount
are references/names of columns.
So, when assigning a formula, I get an exception HRESULT: 0x800A03EC
. I looked up in this answer in order to get explanation and followed some of the instructions there. I determined that my problem is the following: the problem happens due to a function entered in a cell and it is trying to update another cell.
Checked out also this post. I tried quite different (like putting just the formulas without =
and then run over again and put the equal signs), but same problem.
I am clueless of how to approach this.