I am developing a program of an information system for reservoir operation. I have a table, MSFlexGrid1 with 4 columns of Initial Depth, End Depth, Cut Volume, and Fill Volume (see attachment 'a.jpg'). There is a button 'Calculate' next to the table which whenever user clicks the button another form containing another MSFlexGrid table will appear. This table contains 2 columns which are Depth and Cumulative Volume (see attachment 'b.jpg'). Cumulative Volume is the sum of Cut Volume and/or Fill Volume at each Depth. So far i have this code from a helpful friend in Bytes, but somehow it sums only the Cut Volume (CUTVOL).
how can i modify this code to make it calculate both CUTVOL and FILLVOL?
Code:
For ARRAYDATAidx = 2 To UBound(ARRAYDATA) '§ loop trough the ARRAYDATA and add each line in the MSFlexGrid1
MSFlexGrid1.AddItem ARRAYDATA(ARRAYDATAidx).DEPTH1 & vbTab & _
CStr(Format(CSng(ARRAYDATA(ARRAYDATAidx - 1).CUTVOL) + _
CSng(.TextMatrix(ARRAYDATAidx - 1, 1)), "#.0"))
Next
Comment