Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
vba; copy row, paste at offset md[_2_] Excel Programming 2 March 29th 08 07:44 PM
Last cell, copy, paste special, loop AK Excel Programming 2 February 6th 07 11:57 PM
Why Copy/Paste fails using Offset & Resize of myRange? [email protected] Excel Discussion (Misc queries) 3 November 21st 06 02:06 AM
copy and paste with offset kevcar40 Excel Discussion (Misc queries) 3 October 10th 05 03:20 PM
Copy & Paste+Offset Ronald Cayne Excel Programming 2 September 7th 04 07:35 AM


All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"