View Single Post
  #2   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Alan,

Sub CopyRecords()
Dim i As Long
Dim SourceRow As Long, DestRow As Long
SourceRow = 2 ' starting row
DestRow = 2 ' destination row
Do While Cells(SourceRow, 1) < ""
For i = 1 To Cells(SourceRow, 3)
ActiveSheet.Cells(SourceRow, 1).Resize(1, 2).Copy
Destination:=Sheets("List").Cells(DestRow, 1)
DestRow = DestRow + 1
Next i
SourceRow = SourceRow + 1
Loop
End Sub

The source sheet must be the active sheet.

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Alan" wrote in message
42...
I would like to use a macro to copy and repeat lines 'X' times on a new
page. To find out how many times each row is to be copied, the number is
provided in the last column ('C' in this case) of a spreadsheet.
Sample data for start point:

Lastname First Name Qty
Smith John 3
Hank Aaron 5


Result required on new sheet in same spreadsheet:

Lastname First Name
Smith John
Smith John
Smith John
Hank Aaron
Hank Aaron
Hank Aaron
Hank Aaron
Hank Aaron



Can someone provide some macro code that will create the number of
required rows on a new sheet called 'list' within the same spreadsheet?

TIA, Alan