Say I have EXCEL 1 column (100 rows) of integers with values between 1 and 10 (with lrow being the last row). With VB, I am trying to add the rows UP TO a given sum (ex:25) to FIND THE ROW when the given sum (or less if adding the last row will bring the sum to over 25) is achieved.
For i = 1 To lRow
Do While sum < 25
sum= sum+ Cells(i, 1).Value
Cells(2, 5).Value = sum
Next j
i = j-1
Loop
Next i
var j doesn't increment. It keeps adding the fist row. WHY?
note: I want to continue to add the rest of the rows starting with the end position (row) of the first iteration. The reason for why i=j-1 is there.
Next jwith no correspondingFor. Fix that first. Or post your real code.