Apparently the worksheet's Cells.CellPropertyChanged event is not raised when a cell with a formula is recalculated because one of the source cells was changed. Is there any way of getting notified in this situation?
2 Answers, 1 is accepted
answered on 13 Apr 2016, 11:19 AM
The CellPropertyChanged event is used only for notifying if some of the cell properties are changed. As the value of the cell is a formula value, when the formula is recalculated the actual cell value is not changed because the formula remains the same, only the result of its evaluation is changed.
When a cell has a formula value it is stored in the FormulaCellValue object as a FormulaExpression. When some of the cells, which the formula refers are changed the FormulaExpression is invalidated and UI is notified for that invalidation. When the UI is updated all invalidated formulas are evaluated and the new result is presented in the UI.
You could use the following code snippet to track if some FormulaExpression is invalidated. Please bear in mind that you have to detach from the events to prevent memory leaks or use weak events.