Copy each data record of a name list and place it under the onecopied

  • Thread starter Thread starter andreashermle
  • Start date Start date
A

andreashermle

Dear Experts:

I got a name list on a worksheet with the following columns

SURNAME NAME CITY
Smith John New York City
Wilber Joe Denver
Garden Thomas San Diego


This list has for example twenty rows / data records. For certain
reasons the following action should be excecuted automatically (using
VBA) on my list regardless of the number of rows:

Duplicate each row and place it directly under the one copied. The
result would then look like this:

SURNAME NAME CITY
Smith John New York City
Smith John New York City
Wilber Joe Denver
Wilber Joe Denver
Garden Thomas San Diego
Garden Thomas San Diego

Help is much appreciated.

Thank you very much in advance. Regards, Andreas
 
Sub copyeachrow()
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
Rows(i).Copy
Rows(i + 1).Insert
Next i
End Sub
 
Sub copyeachrow()
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
Rows(i).Copy
Rows(i + 1).Insert
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software












- Zitierten Text anzeigen -

Great, it is working. Thank you very much for your professional help.
Regards, Andreas
 
Back
Top