Hey all.
I have an mshflexgrid with some numerical data in it, and Id like to do a command click to count the numbers in each column and total them at the bottom like this
1 | 2
3 | 3
2 | 1
5 | 2
-----------
11 | 8
How would I do this?
Printable View
Hey all.
I have an mshflexgrid with some numerical data in it, and Id like to do a command click to count the numbers in each column and total them at the bottom like this
1 | 2
3 | 3
2 | 1
5 | 2
-----------
11 | 8
How would I do this?
Try something like this
VB Code:
Dim i as long, j as Long, Total as Double For j = 1 to MsFlexgrid1.Cols - 1 Total = 0 For i = 1 to MsFlexgrid1.Rows - 2 'The Row before Last Row Total = Total + Val(MsFlexgrid1.TextMatrix(i, j)) Next MsFlexgrid1.TextMatrix(.Rows-1, j) = Total 'Add Col Total to the last Row Next
Im getting an argument not optional error on
VB Code:
Total = Total + Val(MSHFlexGrid2.TextMatrix)
Specifically on the .textmatrix
I dont know if it matters but im using a MSHFlexGrid and your example uses a MSFlexgrid. I dont know if the Hierarchial thing matters.
I updated the code in my previous post :)
AWESOME! Thanks SO Much!