I'm new to programming and want to make a For loop that selects cells based on the counter:
For indexA = 1 to 10
Range(cells(indexA, indexA + 3)).Select
...
Next indexA
The debugger flags the second line saying "Method 'Range' of object '_Global' failed."
I thought maybe indexA needed to be further defined so I tried
For indexA As Integer = 1 to 10
Range(cells(indexA, indexA +3)).Select
...
Next indexA
Now it won't accept the first line "As Integer" and says "Expected: =" even though there is one.
How can I implement the counter "indexA" in my code, and why isn't it accepting the datatype argument?
For indexA = 1 to 10
Range(cells(indexA, indexA + 3)).Select
...
Next indexA
The debugger flags the second line saying "Method 'Range' of object '_Global' failed."
I thought maybe indexA needed to be further defined so I tried
For indexA As Integer = 1 to 10
Range(cells(indexA, indexA +3)).Select
...
Next indexA
Now it won't accept the first line "As Integer" and says "Expected: =" even though there is one.
How can I implement the counter "indexA" in my code, and why isn't it accepting the datatype argument?