The Counter variable and the Variable Following Next Must be the Same
From Xojo Documentation
Error message
In a For loop, if you use both a counter variable and a variable in the Next statement, they must match. The variable on the Next statement can be omitted.
Sample Code
In the following For loop, the counter variable is i, so the variable on the Next statement must also be i:
See Also
For statement.