Sorry for the late reponse because I was away.
Yes, I was working with visual controls (TsWorksheetGrid)
Attached is my test program for reference. My observations are as follows:
(I) 5000 formula: A1=B1, A2=B2, A3=B3 ...
Approximate calculation time:
16 ms (if workbook not attached to grid <click test1 followed by Calc button>)
203 ms (if workbook is attached to grid <click Attach followed by Calc button>)
(II) 5000 formula: A1=sum(B1:Z1), A2=sum(B2:Z2), A3=sum(B3:Z3) ...
Approximate calculation time:
1108 ms (if workbook not attached to grid <click test2 followed by Calc button>)
1341 ms (if workbook is attached to grid <click Attach followed by Cacl button>)
(III) Open attached excel file bk5000formula.xls. Editing in the grid became very slow if boAutoCalc is set to True.
I would be grateful if you could advise on the following:
i. How to improve my code to speedup the worksheet grid
ii. Is it possible to refresh the grid when all the visible cells are recalculated (I think currently the grid is refreshed after all the formula are recalculated);
iii. As it is now, I am setting boAutoCalc=false so at least the speed is acceptable on faster pc. However, in manual calculation mode, worksheetGrid only display formula (instead of values)- this has lead to another request as posted in
https://forum.lazarus.freepascal.org/index.php/topic,44208.0.html