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

Report
Posts
1
Registration date
Tuesday May 20, 2014
Status
Member
Last seen
May 20, 2014
-
 smiller1712 -
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

1 reply

Posts
2591
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
February 11, 2020
396
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
3
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 4121 users have said thank you to us this month

Brilliant. Saved me a lot of time.

Thanks,