spread sheet problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a sheet in which we are able to insert quantities of certain parts.
I am trying to create a second sheet that if I put in a quanity on the first
sheet it will put that many rows on the second sheet. If a part has a
quantity of zero I want that part to not even show up on the second
sheet.(see below)

first sheet
QTY Part
2 Furances
0 heaters
3 Fans

second sheet
______ Furnaces
______ Furnaces
______ Fans
______ Fans
______ Fans

-We fill in the blanks by hand in the second page
Thanks for your help
 
Try this macro:

HTH



Sub addData()

Dim rng As Range
Dim ws1 As Worksheet, ws2 As Worksheet
Dim i As Long, j As Long

Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")
Set rng = ws2.Cells(2, "B")

With ws1
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To lastrow
For j = 1 To .Cells(i, "A")
rng = .Cells(i, "B")
Set rng = rng.Offset(1, 0)
Next j
Next i
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