loop with vba

asdfasdf

New Member
Joined
Aug 19, 2009
Messages
9
I have about 3000 rows of data in column A. At every 50 cells, i need to get one cell and copy it onto its own row - so cell A1, A51, A101 etc need to be copied to cell C1, D1, E1. I want to loop it because of the amount of data but have no idea at all how to do this
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
try:

Code:
Sub everyFifty()
    lastrow = Cells(Rows.Count, 1).End(xlUp).Row
    x = 1
    Do
        Cells(1, x + 1).Value = Cells(x * 50 + 1, 1).Value
        x = x + 1
    Loop While x * 50 + 1 < lastrow
End Sub

HTH
 
Upvote 0
Hello and welcome to MrExcel.

Try this

Code:
Sub test()
Dim LR As Long, i As Long, j As Long
j = 2
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR Step 50
    j = j + 1
    Cells(1, j).Value = Range("A" & i).Value
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top