Excel.Worksheet.Cells[row,col] = "=Formula / reference"
While in the above Excel updates the formula / reference and shows the result in the datasheet, in the code below, when using Range.set_Value(..)
the datasheet is not updated at all
string[,] myFormulas = new string[nrRows, nrColumns];
...
myFormulas [x,y] = e.g. "=SUM(D1:D" + rowNr + ")";
myFormulas [x,y+1] = e.g. "=Table1!A1";
...
Range.set_Value(Missing.Value, myFormulas)
and it only shows the formula as a string, e.g. =Table1!A1
.
I cannot make it update. Neither with CalucalteAll()
, nor with RefreshAll()
, nor with anyhing. Any suggestions how to achieve an update in the datasheet?
EDIT : You can set an entire array with a single statement Range.set_Value(Missing.Value, myFormulas)
. My question is how to make excel evaluate the formulas in this array (and not treat them as simple strings, or setting the cells one by one which Excel than recalculates.)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…