Reputation: 2060
i have the following scenario.
Cells in Col A and Col B get user entered values (A,B,C or D). If both Cells have Values, the formular in Col C calculated a value ( A & A = 1, C & D = 3, and so on).
exactly the same happens in Col R, S and T
now if i execute my c# code, open the spreadsheet with openxml and manipulate the data (cut values in R and S and paste them in A and B), the formular in C does not refresh.
if i press ctrl + alt + F9, the formular updates. But i cannot explain my customer to update his formulars manually every time :)
any hints on forcing the spreadsheet to recalculate that formular?
Upvotes: 1
Views: 600
Reputation: 2060
myCell.CellFormula.CalculateCell = true;
i tried that before, but i a if statement, where i checked if myCell.DataType !=null
in that case, DataType was null, so that line was not executed.
So, CalculateCell solved the problem.
Upvotes: 1