Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Copy a range of cells 15 rows down and repeat to empty cell

I have Excel 2003 and Windows XP.
My spreadsheet is currently 8,240 lines. I want to copy a range (containing
both absolute and relative cell references) of 15 lines and copy the range
down the 8,000 lines. The code I've tried is:

Sub loop1()
'this loop runs until there is nothing in the next column
Do
Range(Range("K7:R21"), Range("k7:R21").End(xlDown)).Copy Range("K22")
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, 1))
End Sub

It copies one line at a time and bogs down in fairly short order.

--
M.R. Vanatta
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Copy a range of cells 15 rows down and repeat to empty cell

On 5 Jun., 23:05, Mike V wrote:
I have Excel 2003 and Windows XP.
My spreadsheet is currently 8,240 lines. *I want to copy a range (containing
both absolute and relative cell references) of 15 lines and copy the range
down the 8,000 lines. *The code I've tried is:

Sub loop1()
'this loop runs until there is nothing in the next column
Do
Range(Range("K7:R21"), Range("k7:R21").End(xlDown)).Copy Range("K22")
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, 1))
End Sub

It copies one line at a time and bogs down in fairly short order.

--
M.R. Vanatta


Hi

Which cell is the ActiveCell at the start of the macro, ie which
column is used to determine last row to copy to?

Regards,
Per
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Copy a range of cells 15 rows down and repeat to empty cell

The active cell is K7 when the macro starts.
--
M.R. Vanatta


"Per Jessen" wrote:

On 5 Jun., 23:05, Mike V wrote:
I have Excel 2003 and Windows XP.
My spreadsheet is currently 8,240 lines. I want to copy a range (containing
both absolute and relative cell references) of 15 lines and copy the range
down the 8,000 lines. The code I've tried is:

Sub loop1()
'this loop runs until there is nothing in the next column
Do
Range(Range("K7:R21"), Range("k7:R21").End(xlDown)).Copy Range("K22")
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, 1))
End Sub

It copies one line at a time and bogs down in fairly short order.

--
M.R. Vanatta


Hi

Which cell is the ActiveCell at the start of the macro, ie which
column is used to determine last row to copy to?

Regards,
Per

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
Copy Values to next empty cell range Aldo Cella Excel Worksheet Functions 1 March 10th 08 11:22 PM
Copy cell contents in empty rows below it till any unempty row com vtmalhan Excel Discussion (Misc queries) 1 February 11th 08 11:26 AM
Copy cell to empty cells below. [email protected] Excel Programming 3 January 6th 08 05:24 AM
find first empty cell in range and copy information from another workbook [email protected] Excel Programming 19 January 31st 07 02:01 AM
Macro to copy cells one row up then move down 4 rows & repeat Josef Excel Programming 4 October 5th 04 08:49 PM


All times are GMT +1. The time now is 07:04 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"