Duplicate Rows Based On Cell Value?

  • Thread starter Thread starter rviidalepp
  • Start date Start date
R

rviidalepp

Hi,

I´m lookig for:
Pos. Qty W H
1 2 316 910
2 4 399 1180
3 1 784 1180

to become:
Pos. Qty W H
1 2 316 910
1 2 316 910
2 4 399 1180
2 4 399 1180
2 4 399 1180
2 4 399 1180
3 1 784 1180

Thanks!
 
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim LastRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = LastRow To 2 Step -1

If .Cells(i, "B").Value > 1 Then

.Rows(i + 1).Resize(.Cells(i, "B").Value - 1).Insert
.Rows(i).Copy .Cells(i + 1, "A").Resize(.Cells(i,
"B").Value - 1)
End If
Next i

End With

End Sub

--
__________________________________
HTH

Bob

Hi,

I´m lookig for:
Pos. Qty W H
1 2 316 910
2 4 399 1180
3 1 784 1180

to become:
Pos. Qty W H
1 2 316 910
1 2 316 910
2 4 399 1180
2 4 399 1180
2 4 399 1180
2 4 399 1180
3 1 784 1180

Thanks!
 

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