Value keeps incrementing

mirzao

Active member
Joined
Nov 10, 2005
Messages
44
Location
Malaysia
Programming Experience
Beginner
Hi all,
i have a select case and and everytime the code inside is executed it will increment the count and store it inside an array. from the count variable, i do some calculation.

for example, after the 3rd run if count(0)=3 then do some calculation (find seconds=40s) and store it in excel cell, at the 4th run count(0)=0 (second=0s)and the calculation also become zero.After some time, count(0)=5 (second=80s). Is there a way to
obtain the previous value and add to the present value?

Do
For i=0 to 10
Select Case
Case 1
idle = True
count = 1
sum(i) += count

seconds = (sum(i) - 1) * 20
timeCalc(seconds)
Ws.Range("B" & oCP.Port).Value = timeCalc(seconds)
Case 2
end select
Next
Loop
 
Last edited by a moderator:
solution

just declare any other varible...........anduse that variabletoassign the value of count.......so that you can keeptrack of values.....
foreg.....

var abc.
do....loop
for loop..........
abc=count
end for
end while
 
Back
Top