The last major step of this process is to loop through each cell in the grid and update the cell’s displayed value. That’s exactly what happens in Listing 13.18. I set up a loop to check every cell, and if the cell has an equation, then I update the value in the cell by using the Compute function.
Listing 13.18: Recalculate Routine in Charter
Private Sub Recalculate()
Dim i As Integer
Dim j As Integer
For i = 1 To MSFlexGrid1.Rows - 1
For j = 1 To MSFlexGrid1.Cols - 1
If Len(Equations(i, j)) > 0 Then
MSFlexGrid1.TextMatrix(i, j) = Compute(Equations(i, j))
End If
Next j
Next i
End Sub