View Single Post
  #3   Report Post  
Alan
 
Posts: n/a
Default

Earl Kiosterud wrote:
Many thanks Earl, it's working for me.
One more question if I may...
If the sheet "list" doesn't exist, how can I add the sheet "list"? The
command Sheets.add doesn't accept the name list. I also can't assume
that the next sheet added is going to be called "sheet1". Any ideas?

Thx, Alan










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.