Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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-- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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-- |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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-- |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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-- |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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-- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
vba; copy row, paste at offset | Excel Programming | |||
Last cell, copy, paste special, loop | Excel Programming | |||
Why Copy/Paste fails using Offset & Resize of myRange? | Excel Discussion (Misc queries) | |||
copy and paste with offset | Excel Discussion (Misc queries) | |||
Copy & Paste+Offset | Excel Programming |