Repeat row x times
Closed
Richard
-
Feb 22, 2017 at 02:57 PM
vcoolio Posts 1364 Registration date Thursday July 24, 2014 Status Moderator Last seen February 10, 2023 - Mar 1, 2017 at 03:55 AM
vcoolio Posts 1364 Registration date Thursday July 24, 2014 Status Moderator Last seen February 10, 2023 - Mar 1, 2017 at 03:55 AM
Related:
- Excel duplicate rows n times
- Copy and insert rows and number of times ✓ - Excel Forum
- Copy row and insert n times ✓ - Office Software Forum
- Excel date format dd.mm.yyyy - Guide
- Copy rows n times in Excel ✓ - Excel Forum
- Excel duplicate rows based on cell value ✓ - Excel Forum
8 replies
vcoolio
Posts
1364
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
February 10, 2023
252
Feb 23, 2017 at 02:54 AM
Feb 23, 2017 at 02:54 AM
Hello Richard,
Perhaps the following code, assigned to a button, may do the task for you:-
I've prepared a little sample at the following link for you to play with:-
https://www.dropbox.com/s/edpbkfor4j9vlay/Copy%20x%20number%20of%20rows%20to%20sht%202.xlsm?dl=0
Click on the "RUN" button to see it work.
I hope that this helps.
Cheerio,
vcoolio.
Perhaps the following code, assigned to a button, may do the task for you:-
Sub CopyRows() Dim r As Range For Each r In Range("F2", Range("F" & Rows.Count).End(xlUp)) Sheet2.Cells(Rows.Count, 1).End(xlUp)(2).Resize(r.Value, 5) = r.Offset(, -5).Resize(1, 5).Value Next r End Sub
I've prepared a little sample at the following link for you to play with:-
https://www.dropbox.com/s/edpbkfor4j9vlay/Copy%20x%20number%20of%20rows%20to%20sht%202.xlsm?dl=0
Click on the "RUN" button to see it work.
I hope that this helps.
Cheerio,
vcoolio.