ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Duplicating rows help needed (https://www.excelbanter.com/excel-worksheet-functions/163845-duplicating-rows-help-needed.html)

ArthurN

Duplicating rows help needed
 
Hi,
I've got a huge list that looks like this:
-------------------------------
name data 1 data 2 data 3
-------------------------------
book1 2 3 4
book2 4 5 7
book3 5 6 5

I need to duplicate every row (except the heading):
book1 2 3 4
book1 2 3 4
book2 4 5 7
book2 4 5 7

Is there a way to automate this routine? You'd save my life...
Thanx in advance


Max

Duplicating rows help needed
 
Assuming source data in Sheet1, cols A to D, from row2 down

In Sheet2,

Put in A2:
=OFFSET(Sheet1!$A$2,INT((ROWS($1:1)-1)/2),COLUMNS($A:A)-1)
Copy A2 across to D2, fill down as far as required
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"ArthurN" wrote:
Hi,
I've got a huge list that looks like this:
-------------------------------
name data 1 data 2 data 3
-------------------------------
book1 2 3 4
book2 4 5 7
book3 5 6 5

I need to duplicate every row (except the heading):
book1 2 3 4
book1 2 3 4
book2 4 5 7
book2 4 5 7

Is there a way to automate this routine? You'd save my life...
Thanx in advance


Don Guillett

Duplicating rows help needed
 
This should do it

Sub dupallrows()
For i = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
Rows(i).Copy
Rows(i).Insert shift:=xlDown
Next i
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ArthurN" wrote in message
...
Hi,
I've got a huge list that looks like this:
-------------------------------
name data 1 data 2 data 3
-------------------------------
book1 2 3 4
book2 4 5 7
book3 5 6 5

I need to duplicate every row (except the heading):
book1 2 3 4
book1 2 3 4
book2 4 5 7
book2 4 5 7

Is there a way to automate this routine? You'd save my life...
Thanx in advance



Ken Wright

Duplicating rows help needed
 
Insert a helper column at the front and then just number every row starting
at your first row of data. Just put in 1,2,3 and then select them and
double clikc the bottom right of the selection to automatically number
downwards.

Now just copy the entire set of data and paste it underneath the original.
Then just sort on the row numbering you added, and finally delete the
additional helper column.

Should be 60 seconds max

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------


"ArthurN" wrote in message
...
Hi,
I've got a huge list that looks like this:
-------------------------------
name data 1 data 2 data 3
-------------------------------
book1 2 3 4
book2 4 5 7
book3 5 6 5

I need to duplicate every row (except the heading):
book1 2 3 4
book1 2 3 4
book2 4 5 7
book2 4 5 7

Is there a way to automate this routine? You'd save my life...
Thanx in advance





All times are GMT +1. The time now is 12:30 AM.

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