Creating A Breakout List from a Summary List?

  • Thread starter Thread starter cardan
  • Start date Start date
C

cardan

I have a summary list that is the first input on a page that I need to
then list out in individual rows. For example:

Turn this..

Description Total Price per Unit
Unit 1 3 $3.00
Unit 2 2 $2.50
Unit 3 2 $1.25

Into this....

Description Price
Unit 1 $3.00
Unit 1 $3.00
Unit 1 $3.00
Unit 2 $2.50
Unit 2 $2.50
Unit 3 $1.25
Unit 3 $1.25

Is it possible to list out from a summary table? If so, can I do it so
there will be no empty rows in the list out since the totals are always
changing? Thank you !
 
Sub ABC()
Dim rng as Range, cell as Range, rw as Long
Dim i as Long
with worksheets("Sheet1")
set rng = .Range(.Cells(2,2),.Cells(rows.count,2).End(xlup))
End with
rw = 1
With worksheets("Sheet2")
for each cell in rng
for i = 1 to cell.value
rw = rw + 1
.cells(rw,1).Value = cell.offset(0,-1).Value
.cells(rw,2).Value = cell.offset(0,1).Value
Next i
Next
.Cells(1,1).Value = "Description"
.Cells(1,2).Value = "Price"
End With
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top