Works great! Thanks so much for your help!
Alan
Earl Kiosterud wrote:
Alan,
Sub CopyRecords()
Dim i As Long
Dim SourceRow As Long, DestRow As Long
Dim Wks As Worksheet
Dim HaveSheetList As Boolean
SourceRow = 2 ' starting row
DestRow = 2 ' destination row
For Each Wks In ActiveWorkbook.Sheets ' search for sheet named "List"
If Wks.Name = "List" Then ' found one
HaveSheetList = True ' set flag
Exit For ' get out
End If
Next Wks
If Not HaveSheetList Then ' don't have "List"
Sheets.Add ' add it
ActiveSheet.Name = "List" ' name it
End If
Do While Sheets("Master").Cells(SourceRow, 1) < ""
For i = 1 To Sheets("Master").Cells(SourceRow, 3)
Sheets("Master").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 is called "Master" now. You can change occurences
of Sheets("Master") to reflect the name of your source sheet. Note
that this will start copying records to row 2 even if "List" already
exists and has stuff in it.
|