Copy X Row N Number of Times [Solved/Closed]

lionsclaw 1 Posts Tuesday May 20, 2014Registration date May 20, 2014 Last seen - May 20, 2014 at 03:00 AM - Latest reply:  smiller1712
- Jul 21, 2014 at 10:08 AM
Hi.

I need the formula to Copy X Row N No.of Times.
For Example

Col 1 Col 2
ABC 3
DEF 5
GHI 4


Outcome
Col 3
ABC
ABC
ABC
DEF
DEF
DEF
DEF
DEF
GHI
GHI
GHI
GHI
See more 

2 replies

Best answer
TrowaD 2396 Posts Sunday September 12, 2010Registration dateModeratorStatus July 19, 2018 Last seen - May 20, 2014 at 11:00 AM
2
Thank you
Hi Lionsclaw,

The following code will do as requested:
Sub RunMe()
Dim lRow As Long
Dim x, MyCount As Integer

lRow = Range("A1").End(xlDown).Row

For Each cell In Range("A1:A" & lRow)
    cell.Copy
    MyCount = cell.Offset(0, 1)
    
    Do
        x = x + 1
        Range("C" & x).PasteSpecial
        MyCount = MyCount - 1
    Loop Until MyCount = 0
Next cell
        
Application.CutCopyMode = False
End Sub


Best regards,
Trowa

Thank you, TrowaD 2

Something to say? Add comment

CCM has helped 1667 users this month

Brilliant. Saved me a lot of time.

Thanks,