I have a long spreadsheet with formulae such as "=AANTALLEN.ALS($A$3:$A$892;2;$D$3:$D$892;"Meerderheid";$E$3:$E$892;"Positief")".

The range has changed, so I have to manually change $892 by $878 in the formulae everywhere. I want to use fpspreadsheet to automate this.

This is my code:

for i := FormuleTabelCoord.Y1 to FormuleTabelCoord.Y2 do // elke rij

for j := FormuleTabelCoord.X1 to FormuleTabelCoord.X2 do begin

cell := WS.FindCell(i,j);

s := WS.ReadFormula(cell); // lees de formule

if HasFormula(cell) then t := 'With formula ' else t := 'No formula ';

showmessage(t + inttostr(i) + ' ' + inttostr(j) + ' |' + s + '|'); // for test

s := StringReplace(s,'$892;','$878;',[rfReplaceAll]);

WS.WriteFormula(cell,s);

end;

The processed cells do not contain the changed formula. The message says "No formula".

Ihe calculated result of the formula is in the cell when verified with Excel, not the formula.

No errors are flagged.

Using fpspreadfsheet 1.12.0.0