Hello everyone ! (PS. I ll really send a box of chocolate cause I have this issue for a while now!)
Here is my issue: I have datas from 1 to 100 (lines) ans 1 to 261 columns
With those datas I want to create a matrix, called matrix_lockin (i,j)
only when the IF is true, the value must be equal to the cell
but when it's not true, all the
rest of the line must be equal to 0,03
for instance, for the first line of my matrix:
0,10 0,14 0,03 0,03 till the end
then we need to do the same for the next i
so when if is false, I had to create another FOR loop , especially for the the J
but when I used J, it said "cotnrol variable already in use".. SO I changed it to k... When all the k are done, I need to jump out of the for loop so that i can do the same for the i...
that's why I put a EXIT for ...
The code is below.
The problem isThe first line of my matrix is perfect but the rest of the line are exactly the same as the first line (i = ligne)
And as soon as the debug reaches the first line of my sub
: Static Sub lockin(nb_pas As Integer)
the matrix lockin has already datas inside (all the lines are the first line)
I don't understand at all the debugging part.
Thanks a lot in advance !
Code:
For i = 1 To nb_pas
For j = 1 To 261
If Cells(4, 1 + j) < 0.22 Then
matrice_lockin(i, j) = Cells(4, 1 + j)
Else
For k = j To 261
matrice_lockin(i, k) = 0.03
Next k
Exit For
End If
Next j
Next i