-
Hello,
I got a problem.
I have a sub2(i,n) which consists of a For Next statement.
sub2(i,n)
For l(i)=1 to n
.......
......
i=i+1
n=n-1
Call sub2(i,n)
Next
End sub
So i get nested for next loops.
So when it has called all the same subs within sub2 he has to loop through all those for next statements.
The problem is that it doesn't use the corresponding i and n in the different loops anymore which I passed as value. Instead he uses the last values passed.
How can i tackle this?
Any help greatly appreciated...
Kind regards,
Gertjan Oonk
-
If I understand you well, you want your i and n values to be passed by value. VB receives parameters by reference by default.
There is two way to force VB to pass parameters by value:
sub2(ByVal i, ByVal n)
or on the call
Call sub2 (i), (n)
Hope it will help...