In VBA, running in Excel, I am running a basic loop that fills an array with values. The code is as below.
What I find curious, is the value of Counter starts at 0, yet ends at 7, rather than 6. I can note this when I'm looking in the Locals window and running the code step-by-step. It seems the value becomes 7 on its last instance of running 'Next'
Is this normal, or is there something I'm doing wrong?
It doesn't seem to change the outcome here, but if I'm using more complicated code, I want to be sure this is what I should be expecting.
Sub ArrayLoop()
Dim myArray(6) As String
Dim Counter As Integer
For Counter = 0 To 6
myArray(Counter) = Range("A1").Offset(Counter, 0).Value
Next
End Sub