#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default copy offset rows

I have a column of names in consecutive rows. I want to copy them to another
sheet where the 1st name is in row 5 then the 2nd name is in row 15 etc with
an increase of 10 rows between the copied names.
If I try to copy a formula it just takes every 10th name not the next one.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 464
Default copy offset rows

Try;

Sub CopyNames()
Dim rCell As Range
Dim strFirst As String
Dim strSecond As String
Dim lFirst As Long
Dim lSecond As Long
Dim ws As Worksheet
'CodeName
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm
Set ws = Sheet2
lFirst = 5
lSecond = 15
For Each rCell In Range("A2", Cells(Rows.Count, 1).End(xlUp))
strFirst = Split(rCell)(0)
strSecond = Split(rCell)(1)
With ws
.Cells(lFirst, 1) = strFirst
.Cells(lSecond, 1) = strSecond
End With

lFirst = lSecond + 5
lSecond = lFirst + 10
Next rCell
End Sub



--
Regards
Dave Hawley
www.ozgrid.com
"JPreeshl" wrote in message
...
I have a column of names in consecutive rows. I want to copy them to
another
sheet where the 1st name is in row 5 then the 2nd name is in row 15 etc
with
an increase of 10 rows between the copied names.
If I try to copy a formula it just takes every 10th name not the next one.


  #3   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default copy offset rows

Here's an easy formulas way to deliver it ..
Assume your source data (names) is in Sheet1, running consecutively in A2 down
In another sheet,
put this in the starting cell of your choice, say in A5:
=IF(MOD(ROWS($1:1)-1,10)=0,OFFSET(Sheet1!$A$2,INT((ROWS($1:1)-1)/10),),"")
Copy down as far as required to exhaust the extract of names. You'd get the
1st name in A5, the 2nd name in A15, 3rd in A25 and so on. In between, the
formula will return "blanks". Exactly as desired. Easily adapt the interval:
10 in both the MOD and INT parts to suit other intervals. Change/point the
OFFSET's anchor, ie: Sheet1!$A$2 to suit where your actually source data
starts. Inspiring? hit the YES below
--
Max
Singapore
---
"JPreeshl" wrote:
I have a column of names in consecutive rows. I want to copy them to another
sheet where the 1st name is in row 5 then the 2nd name is in row 15 etc with
an increase of 10 rows between the copied names.
If I try to copy a formula it just takes every 10th name not the next one.

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
Repost: Copy and Offset cell reference CJ[_2_] Excel Worksheet Functions 1 September 5th 08 03:38 PM
Copy link to offset sheet SNACK D Excel Worksheet Functions 5 December 14th 07 01:38 AM
Offset every # of Rows Javier Diaz[_2_] Excel Worksheet Functions 8 July 13th 07 06:08 PM
copy offset to cell Kev Excel Discussion (Misc queries) 6 December 31st 06 04:02 AM
copy and paste with offset kevcar40 Excel Discussion (Misc queries) 3 October 10th 05 03:20 PM


All times are GMT +1. The time now is 08:34 AM.

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"