ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy (A2:A26) paste, offset one cell, do it again. Loop 256 tim (https://www.excelbanter.com/excel-programming/435299-copy-%E2%80%9Ca2-a26%E2%80%9D-paste-offset-one-cell-do-again-loop-256-tim.html)

RyGuy

Copy (A2:A26) paste, offset one cell, do it again. Loop 256 tim
 
I am trying to figure out a way to take a range (A2:A26) and copy/paste it
into range (D55:D79) then offset one cell down, then do it again, so
(A2:A26) copy/paste to (D81:D105) and so on and so forth. I want it to
run 256 times.

I am looking for a sample of code that I thought I had somewhere in my
library, but cant seem to find it now. Any ideas?

Thanks,
Ryan--


Mike H

Copy (A2:A26) paste, offset one cell, do it again. Loop 256 tim
 
Hi,

Try this

Sub Versive()
Range("A2:A26").Copy
For x = 55 To 1430 Step 26
Cells(x, 4).PasteSpecial
Next
End Sub

Mike

"RyGuy" wrote:

I am trying to figure out a way to take a range (A2:A26) and copy/paste it
into range (D55:D79) then offset one cell down, then do it again, so
(A2:A26) copy/paste to (D81:D105) and so on and so forth. I want it to
run 256 times.

I am looking for a sample of code that I thought I had somewhere in my
library, but cant seem to find it now. Any ideas?

Thanks,
Ryan--


RyGuy

Copy (A2:A26) paste, offset one cell, do it again. Loop 256
 
Thanks! Very cool. This macro worked pretty well too:

Sub CopyDown()
Dim lstRw As Long
lstRw = Cells(Rows.Count, 1).End(xlUp).Row
Do Until lstRw = 7000
ActiveCell.Resize(26, 1).Copy ActiveCell.Offset(26, 0)
lstRw = lstRw + 2
Range("A" & lstRw - 9).Activate
Loop
End Sub

It was off by one row, so I inserted one cell down, and everything lined up
nicely.

Hope this helps others.


Thanks again Mike!
Ryan--


"Mike H" wrote:

Hi,

Try this

Sub Versive()
Range("A2:A26").Copy
For x = 55 To 1430 Step 26
Cells(x, 4).PasteSpecial
Next
End Sub

Mike

"RyGuy" wrote:

I am trying to figure out a way to take a range (A2:A26) and copy/paste it
into range (D55:D79) then offset one cell down, then do it again, so
(A2:A26) copy/paste to (D81:D105) and so on and so forth. I want it to
run 256 times.

I am looking for a sample of code that I thought I had somewhere in my
library, but cant seem to find it now. Any ideas?

Thanks,
Ryan--


Mike H

Copy (A2:A26) paste, offset one cell, do it again. Loop 256
 
Got the end value for the loop wroong, try this

For x = 55 To 6701 Step 26

"Mike H" wrote:

Hi,

Try this

Sub Versive()
Range("A2:A26").Copy
For x = 55 To 1430 Step 26
Cells(x, 4).PasteSpecial
Next
End Sub

Mike

"RyGuy" wrote:

I am trying to figure out a way to take a range (A2:A26) and copy/paste it
into range (D55:D79) then offset one cell down, then do it again, so
(A2:A26) copy/paste to (D81:D105) and so on and so forth. I want it to
run 256 times.

I am looking for a sample of code that I thought I had somewhere in my
library, but cant seem to find it now. Any ideas?

Thanks,
Ryan--


Mike H

Copy (A2:A26) paste, offset one cell, do it again. Loop 256
 
Glad I could help and thanks for the feedback

"RyGuy" wrote:

Thanks! Very cool. This macro worked pretty well too:

Sub CopyDown()
Dim lstRw As Long
lstRw = Cells(Rows.Count, 1).End(xlUp).Row
Do Until lstRw = 7000
ActiveCell.Resize(26, 1).Copy ActiveCell.Offset(26, 0)
lstRw = lstRw + 2
Range("A" & lstRw - 9).Activate
Loop
End Sub

It was off by one row, so I inserted one cell down, and everything lined up
nicely.

Hope this helps others.


Thanks again Mike!
Ryan--


"Mike H" wrote:

Hi,

Try this

Sub Versive()
Range("A2:A26").Copy
For x = 55 To 1430 Step 26
Cells(x, 4).PasteSpecial
Next
End Sub

Mike

"RyGuy" wrote:

I am trying to figure out a way to take a range (A2:A26) and copy/paste it
into range (D55:D79) then offset one cell down, then do it again, so
(A2:A26) copy/paste to (D81:D105) and so on and so forth. I want it to
run 256 times.

I am looking for a sample of code that I thought I had somewhere in my
library, but cant seem to find it now. Any ideas?

Thanks,
Ryan--



All times are GMT +1. The time now is 06:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com