| | | | Browse by category |
Problem
How do I update formula cells that have a reference to a cell which has been changed with SetValueRange()?
Cause
Action
If you programmatically change cells with SetValueRange() you have to call RefreshViews() to force recalculation of depending formula cells. RefreshViews() will determine those cells that are depending on previously modified cells and update them in the grid window if their value has changed.
If you prefer not to update the grid window you can call Recalc(). Recalc() also determine those cells that are depending on previously modified cells and mark them to be recalculated the next time you call GetValueRowCol(). However, you have to completely redraw the whole grid later to be sure that display contents are in sync with the actual values.
If you do call neither RefreshViews() nor Recalc() formula cells will not be recalculated. The reason why SetValueRange() does not recalculate depending cells is because often there will be subsequent changes to neighboring cells. It is much faster to do recalculate cells all at once instead of recalculating cells with each SetValueRange() call.