Excel Macro help, copy rows and paste rows X times below

Closed
kaidai Posts 1 Registration date Thursday May 4, 2017 Status Member Last seen May 4, 2017 - May 4, 2017 at 12:33 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - May 8, 2017 at 11:43 AM
Hello,

I need an macro to simply the below operation.
I want to copy below text x times

A B C
D E
F G


If I want to output it 3x, the the output will be

A B C
D E
F G
A B C
D E
F G
A B C
D E
F G

Any help greatly appreciated
Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
May 8, 2017 at 11:43 AM
Hi KaiDai,

Give the following code a try (assuming data is located over cell A1):
Sub RunMe()
Dim x As Integer

x = InputBox("What is x?", "Output x number of times")

Range("A1").CurrentRegion.Copy

Do
    Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial
    x = x - 1
Loop Until x = 1

Application.CutCopyMode = False
End Sub


Best regards,
Trowa
0