ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying and skipping (adding) rows (https://www.excelbanter.com/excel-programming/351142-copying-skipping-adding-rows.html)

[email protected]

Copying and skipping (adding) rows
 
Hi.
I have a column of data that runs from row 2:53. I want to paste this
data into another worksheet, but for each line of data I want to skip
down ten rows.
Here's a illustration of the data (immigration data):

Worksheet 1 (Year 1995)
State Afghanistan
Alabama 500
Alaska 100
Arizona 900
.. .
.. .
.. .

Worksheet 2 1995-2005
State Year Afghanistan
Alabama 1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
Alaska 1995
1996
.. .
.. .
.. .

So, I want to paste the Alabam's 1995 from the 1st worksheet into the
1995 year in the 2nd worksheet, skip ten rows down paste Alaska, and so
on...

Thanks for any help.
Matt Hall
Penn State


Tom Ogilvy

Copying and skipping (adding) rows
 
i = 2
for each cell in Worksheets("Sheet1").Range("A2:A53")
Worksheets("Sheet2").Cells(i,1) = cell
yr = 1995
for j = i to i + 11
worksheets("Sheet2").Cells(i,2) = yr
yr = yr + 1
Next
i = i + 12
Next
Worksheets("Sheet2").Range("A1:C1").Value = _
Array("State","Year","Afghanistan")

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hi.
I have a column of data that runs from row 2:53. I want to paste this
data into another worksheet, but for each line of data I want to skip
down ten rows.
Here's a illustration of the data (immigration data):

Worksheet 1 (Year 1995)
State Afghanistan
Alabama 500
Alaska 100
Arizona 900
. .
. .
. .

Worksheet 2 1995-2005
State Year Afghanistan
Alabama 1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
Alaska 1995
1996
. .
. .
. .

So, I want to paste the Alabam's 1995 from the 1st worksheet into the
1995 year in the 2nd worksheet, skip ten rows down paste Alaska, and so
on...

Thanks for any help.
Matt Hall
Penn State





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com