repeat entry based on value in cell
Sub buildlist()
Dim rng As Range
Dim cell As Range, rw As Long
Dim sh As Worksheet, i As Long
Set sh = Worksheets("Dest")
With Worksheets("Data")
Set rng = .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown))
End With
rw = 2
For Each cell In rng
For i = 1 To cell.Offset(0, 4).Value
sh.Cells(rw, 1).Value = cell.Value
rw = rw + 1
Next i
Next cell
End Sub
--
Regards,
Tom Ogilvy
"T. Valko" wrote in message
...
Hi Folks!
I'm helping someone over in the .Functions group. It's a data extraction
problem.
Here's what we have:
...............header1.....header2.....header3.... .Count
Data1.......date1.........date2........date3...... .....2
Data2.......date1.........date2........date3...... .....1
Data3........................date2........date3... .........0
Data4.......date1........date2.................... .........2
Data5.........................................date 3............1
The count column is the numbers of dates that Data(n) meets a criteria,
the month number.
We need to create a list of Data(n) that repeats based on the number in
the Count column. Like this:
Data1
Data1
Data2
Data4
Data4
Data5
I can do this with a couple of helper formulas but it is a real PITA and
is the hardest part of solving this problem. We need this list output to a
different sheet.
Thanks!
Biff
|