Hi to All,
maybe it's a simple thing, but it just doesn't come to mind.
I have 25 variables with the same name, for example "public var (25)"
How can I get a variable that is the total of some consecutive of them? for example:
total5 = var1 + var2 + var3 + var4 + var5
or
total23 = var1 + var2 + var3 + ............ var23
Thanks
Regards
Smile
To simplify it, you can use a loop to do the math.
Public ValuesToTotal As Long
Public Result
Public var(25)
Dim i As Long
'Main Program
BeginProg
Scan (1,Sec,0,0)
Result = 0
For i = 1 To ValuesToTotal
Result += var(i)
Next i
NextScan
EndProg
Hi JDavis many thanks for reply.
I did not understand very well, but your example has stimulated my imagination ;-)
I still have to do a test, but it might work. I have to try like this:
For n=1 To 25
Total(n)=0
For i=1 To n
Total(n)=Total(n)+VAR(i)
next i
next n
........
what I may not have explained well, is that there are as many totals, as many as the VARs.
regarsd
Smile