Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delaying excel calculations during interop C#

I have to input several hundred cells into an excel sheet from a C# program. Each time I set a cell or a range, excel slowly responds... presumably updating various outputs between each input I add. Is there a way to disable calculations from my C# program, and re-enable it after I am done setting cells and ready to read the outputs?

like image 613
tbischel Avatar asked Nov 23 '10 18:11

tbischel


People also ask

Why is my Excel not calculating automatically?

Check for Automatic Recalculation On the Formulas ribbon, look to the far right and click Calculation Options. On the dropdown list, verify that Automatic is selected. When this option is set to automatic, Excel recalculates the spreadsheet's formulas whenever you change a cell value.

How do you refresh formulas in Excel?

Manual calculation shortcuts In Manual mode, you can refresh formulas by pressing F9. You can also click the Calculate Now or Calculate Sheet buttons in the Formulas ribbon. This can help you save time and avoid the stress of waiting for Excel to finish updating formulas!


1 Answers

Yes, set the Application.Calculation to xlCalculationManual, then back to xlCalculationAutomatic.

You can also consider setting Application.ScreenUpdating to false and then back to true.

like image 153
GSerg Avatar answered Sep 19 '22 21:09

GSerg