Below is a macro that will prompt the user to select a preset cell value (ie.A2) and quantity (ie.B2). The cell value A2 will be repeated (pasted) by the amount specifed in B2. The macro currently asks the for the starting cell of where those x amount of A2 values should begin to be pasted.
Question - How can the macro be modified to automatically start repeating the x amount of A2 values in the cell below the original A2 value AND for a total count of quantity B2? IOW, if the quantity = 5, the total repeated values in the column should be 5 (not 6) .
Code below and file attached showing before and after scenarios.
Sub PartMultiplier()
Dim Rng As Range
Dim InputRng As Range, OutRng As Range
xTitleId = "Part Multiplier"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Select P/N and Quantity Cells:", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
Set OutRng = OutRng.Range("A1")
For Each Rng In InputRng.Rows
xValue = Rng.Range("A1").Value
xNum = Rng.Range("B1").Value
OutRng.Resize(xNum, 1).Value = xValue
Set OutRng = OutRng.Offset(xNum, 0)
Next
End Sub
Thanks in advance,
~Tina