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:

Dim i, j As Integer
For i = 1 To 10
j = j + 1
Next j // Should be i or omit it entirely

See Also

For statement.