When I use an array to index a set of nested for loops, I get an error ("For control variable already in use"). See this short script, for example:
When I use do-until loops, it works, though. For example, this script works:
I'm willing to use the do-until loops, but I'm wondering if I'm doing something wrong with the for loops. Any thoughts?
Code:
Sub testArrayFor()
Dim myArray(1)
For myArray(1) = 1 To 2
For myArray(0) = 3 To 4
MsgBox myArray(1) & myArray(0)
Next myArray(0)
Next myArray(1)
End Sub
Code:
Sub testArrayDo()
Dim myArray(1)
myArray(1) = 1
Do Until myArray(1) > 2
myArray(0) = 3
Do Until myArray(0) > 4
MsgBox myArray(1) & myArray(0)
myArray(0) = myArray(0) + 1
Loop
myArray(1) = myArray(1) + 1
Loop
End Sub