-
Feb 8th, 2006, 11:43 AM
#1
Thread Starter
Addicted Member
[Resolved]Totaling up columns in an mshflexgrid
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?
Last edited by DKasler; Feb 8th, 2006 at 12:11 PM.
-----MY SITES-----
BayRidgeNights.Com - NYC Nightlife Forums
Fight Communism - Rate Posts!
-
Feb 8th, 2006, 11:49 AM
#2
Re: Totaling up columns in an mshflexgrid
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
Last edited by jcis; Feb 8th, 2006 at 11:52 AM.
-
Feb 8th, 2006, 11:59 AM
#3
Thread Starter
Addicted Member
Re: Totaling up columns in an mshflexgrid
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.
-----MY SITES-----
BayRidgeNights.Com - NYC Nightlife Forums
Fight Communism - Rate Posts!
-
Feb 8th, 2006, 12:03 PM
#4
Re: Totaling up columns in an mshflexgrid
I updated the code in my previous post
-
Feb 8th, 2006, 12:10 PM
#5
Thread Starter
Addicted Member
Re: Totaling up columns in an mshflexgrid
-----MY SITES-----
BayRidgeNights.Com - NYC Nightlife Forums
Fight Communism - Rate Posts!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|