Sub y_Replicate_Data() Dim i As Variant Dim J As Variant Dim k As Variant If MsgBox("Would you like to replicate the data records based on the number of units in Column E?" & vbCrLf & vbCrLf & _ "Please make SURE ..." & vbCrLf & vbCrLf & _ "(1)... that the number of units are located in Column E and ..." & vbCrLf & _ "(2)... the article numbers are sorted in ascending orders!", vbYesNo + vbQuestion, "Replicate Data") = vbNo Then Exit Sub End If UsedRange = ActiveSheet.UsedRange.Rows.Count For i = UsedRange To 2 Step -1 J = ActiveSheet.Cells(i, 5) For k = J - 1 To 1 Step -1 Set Rng = ActiveSheet.Range("E" & i).EntireRow Rng.Copy Rng.Offset(1).Insert Shift:=xlDown Next Next End Sub
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
25 Experts available now in Live!