below code (courtesy of an EE expert) replicates data records
based on numbers located in Column E
, e.g. ...
the data record where the column E contains the number '5' is replicated five times, etc.
Could somebody please tweak this macro so that the Column in which the replication factors are located ...
... is not hard coded (i.e. Column E) .
Instead, the user should be prompted via inputbox
to specify that 'replication factor column'.
Help is very much appreciated.
Thank you very much in advance.
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
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