Copy from one cell to another using VBA

lar48ry

Board Regular
Joined
Feb 4, 2005
Messages
53
How do I copy and paste the following (using VBA):

Cell A1 to Cell C2
Cell A2 to Cell C7
Cell A3 to Cell C12

until all cells in column A are copied into every 5th cell in Column C after Cell A1 is copied to Cell C2?

Thank you,
Larry
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try

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
    Range("C" & j).Value = Range("A" & i).Value
    j = j + 5
Next i
End Sub
 
Upvote 0
Perhaps something like this:
Code:
Sub MyLoop()
 
    Application.ScreenUpdating = False
    
    Dim i As Long
    For i = 1 To Range("A1").End(xlDown).Row
        Cells(i * 5 - 3, "C") = Cells(i, "A")
    Next i
    
    Application.ScreenUpdating = True
        
End Sub
 
Upvote 0
Thanks VoG,

It worked like a charm.

Thanks Joe4,

I didn't try this one because the first one worked so well. I'll give it a try when I need to try this across multiple workbooks.

I appreciate the rapid response to this situation. I kept racking my brain but couldn't figure out the the step through requirements.

Larry
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,234
Members
448,951
Latest member
jennlynn

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