Loop with 2 variabiles

IoanZ

New Member
Joined
Mar 2, 2018
Messages
44
Hello to everyone

Pleas help me

I use this vba code to create a loop
Sub Loop()
For i = 1 To 250 Step 6
For j= 1 To 60
Cells(i, 1) = j
Next j
Next i

End Sub

The result is
60
60
60
60

<tbody>
</tbody>

I want to know which is vba code to obtain

1
2
3
4

<tbody>
</tbody>


Thank's
 
Last edited:

MrIfOnly

Active Member
Joined
Nov 10, 2016
Messages
489
No need to loop j, just increment it.
Code:
j = j + 1
As an exercise try putting the above line before, then after the Cells(i, 1) = j line.

Regards,

CJ
 

Forum statistics

Threads
1,085,468
Messages
5,383,876
Members
401,859
Latest member
tomahawk61

Some videos you may like

This Week's Hot Topics

Top