Basic macro and arrays

Hello,

I problem with LibreOffice Calc Macro Basic.

I have following kind sentence in a For loop with If sentences.

a(i) = b + a(i)

I liked add to array a(i) its previous value (and value of B). They are double variants.

Do you imagine that your question allows another person to read it, understand how to run it (i.e., which code surrounds it - the function it is in, as well as all functions needed to call it), and which specific error you see on your unstated system (OS and LO version)? Basically, what you asked in not different from a simple

“HELP!!!”

???
If a is dimensioned as an array with element type Variant (default) or any number type and b is an accessible simple variable of one of these types the only problem I can imagine is that the values assigned to the loop variable i for every passage are sometimes outside the index range of the array.
However, you would get an error message telling this.

I got this example working finally. So, now I know that it supposed to work liked this, therefore my original problem is something else. I keep seaching.
Thank you.