[Solved]VBA\Excel
o While logic question
Inside the Do While loop, if RowId-Row < 1 an error will occur.
I would have though that the "And (RowId-Row) > 0" Clause would catch this, but it doesn't and so the error happens.
This is in VBA (although the example isnt).
Does the evaluation of the clauses happen at the end of the loop? maybe im just missing something really simple
(in the full code,Row is a negative number used to offset RowId to find a cell based on the current selection)
Can anyone see why it's dying? Any help would be apprecianted
Solved: RowId - Row = 10 - (-1) = 10 + 1 = 11
Negative numbers suck
it would always be > 0

Inside the Do While loop, if RowId-Row < 1 an error will occur.
I would have though that the "And (RowId-Row) > 0" Clause would catch this, but it doesn't and so the error happens.
This is in VBA (although the example isnt).
Does the evaluation of the clauses happen at the end of the loop? maybe im just missing something really simple

Code:
Bool Found = False
Int Row = 0
Int RowId = 10
Do While Found = False And (RowId - Row) > 0
DoStuff.to(RowId-Row)
Row = Row - 1
Loop
(in the full code,Row is a negative number used to offset RowId to find a cell based on the current selection)
Can anyone see why it's dying? Any help would be apprecianted

Solved: RowId - Row = 10 - (-1) = 10 + 1 = 11
Negative numbers suck

Last edited: