|
-
May 14th, 2006, 02:45 PM
#1
Thread Starter
Lively Member
[Resolved] Summing an array
Hiya
I thought I had this piece of code working, but when debugging realised it is not adding up all of the totals.
I have an array which is called Data(0 to 3)
Each of the array elements have a figure and I need to add these together./ Figures are:
0 - 90
1 - 54
2 - 20
3 - 54
When running this code - I thought tit would add them up, but it is only counting the firs tfigure on the array. code I have is
Visual basic
-------------------------------------------------------------------------
Sub DrawPieChart()
'Create an array to enable the prgoram to calculate the percentages
Dim Total as Integer
Total = 0
For Total = Data(0) To Data(3)
Next Total
-------------------------------------------------------------------------
I have tried changing this to add in total = total + data(i), but it then calculates 0.
Can anyone help me? I am sure this is a small change required.......but just hitting a brick wall.....
Thanks
Tracey
Last edited by Tazmania; May 15th, 2006 at 11:05 AM.
Reason: Resolved
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
|