PC Review


Reply
Thread Tools Rate Thread

Creating a Copy/Paste Loop

 
 
Bonbon622@gmail.com
Guest
Posts: n/a
 
      7th Nov 2007
Hello all! I'm brand new to macros and VBA. I've searched
everywhere, but can't seem to come up with a solution for this simple
task. I have 45 rows x 4 columns worth of data that need to be copied
down in 51 row increments (no column movement). Right now I'm using
the code below and it works once, but I need to highlight the newly
created cell and repeat manually. The last row to paste the selection
on is 1565. I have no idea how to make it loop. Any help would be
greatly appreciated!

ActiveCell.Resize(45, 4).Copy.ActiveCell.Offset(51, 0)
Application.CopyCutMode = False

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      7th Nov 2007
This will go to row 1575.

Sub cpy51()
lstRw = Cells(Rows.Count, 1).End(xlUp).Row
Do Until lstRw >= 1565
ActiveCell.Resize(45, 4).Copy ActiveCell.Offset(51, 0)
lstRw = lstRw + 51
Range("A" & lstRw - 44).Activate
Loop
End Sub

"(E-Mail Removed)" wrote:

> Hello all! I'm brand new to macros and VBA. I've searched
> everywhere, but can't seem to come up with a solution for this simple
> task. I have 45 rows x 4 columns worth of data that need to be copied
> down in 51 row increments (no column movement). Right now I'm using
> the code below and it works once, but I need to highlight the newly
> created cell and repeat manually. The last row to paste the selection
> on is 1565. I have no idea how to make it loop. Any help would be
> greatly appreciated!
>
> ActiveCell.Resize(45, 4).Copy.ActiveCell.Offset(51, 0)
> Application.CopyCutMode = False
>
>

 
Reply With Quote
 
Bonbon622@gmail.com
Guest
Posts: n/a
 
      7th Nov 2007
Thank you so much!! Now I understand the concept!!!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy paste loop---new to vba =?Utf-8?B?TUZS?= Microsoft Excel Programming 4 26th Oct 2006 08:25 PM
Copy and Paste using a loop bestie via OfficeKB.com Microsoft Excel Programming 0 3rd Aug 2006 08:57 AM
Creating Loop to Paste Array =?Utf-8?B?TmF0ZQ==?= Microsoft Excel Programming 1 5th Jan 2006 03:59 AM
Copy/Paste Loop =?Utf-8?B?SmVsbHknJ3M=?= Microsoft Excel Programming 2 7th Dec 2005 12:03 AM
copy and paste loop Dillonstar Microsoft Excel Programming 1 11th Dec 2003 04:22 PM


Features
 

Advertising
 

Newsgroups
 


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