Copy/paste a range 'n' times.

Solved/Closed
V_angel54 Posts 2 Registration date Tuesday June 6, 2017 Status Member Last seen June 8, 2017 - Updated on Jun 8, 2017 at 03:17 AM
vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 - Jun 9, 2017 at 03:17 AM
Hello,

I have a highlighted portion and I want to copy and paste it 200 times. Is there a code or formula to do this automatically? Or must I hit crtl+v 200 times? Help I have limited knowledge on formulas and code in excel.

Thank you!

Related:

1 response

vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 259
Jun 8, 2017 at 03:14 AM
Hello V_Angel54,

I assume that you simply high-light the data range that you wish to copy x number of times and that you paste it at the bottom of the existing data set in the same sheet. If so, the following code, placed in a standard module and assigned to a button may do the task for you:-

Sub CopySelection()

    Dim SCT As Long '----> SCT simply stands for "Selection Copy Times"
    Dim i As Long

SCT = Sheet1.[E1].Value
    
    If SCT > 0 Then
        For i = 1 To SCT
            Selection.Copy Sheet1.Range("A" & Rows.Count).End(3)(2)
        Next i
    End If
    
Sheet1.[E1] = ""
Application.CutCopyMode = False

End Sub


Following is the link to a small sample I made up for you to play with:-

https://www.dropbox.com/s/did79tutwlcqi1l/Copy%20selection%20n%20times.xlsm?dl=0

Enter the number of times that you wish to copy any selection into the yellow box (cell E1), select(high-light) the range that you wish to copy and click on the "RUN" button. The selection will be copied to the bottom of the existing data set the number of times that you have entered into the yellow box (cell E1).

I hope that this helps,

Cheerio,
vcoolio.
0
V_angel54 Posts 2 Registration date Tuesday June 6, 2017 Status Member Last seen June 8, 2017
Jun 8, 2017 at 02:53 PM
Thank you!
0
vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 259 > V_angel54 Posts 2 Registration date Tuesday June 6, 2017 Status Member Last seen June 8, 2017
Jun 9, 2017 at 03:17 AM
You're welcome V_Angel. Glad that I was ale to help.

Cheerio,
vcoolio.
0