Copy and paste multiple times

Deepakpilla36

New Member
Joined
May 19, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello All,

I have a problem in writing a code to copy and paste multiple times.

I have 2 sheets, where in sheet 1 I have 160 Rows and 3 columns.
I need to copy each row and paste 15 times in sheet 2.

can anyone help me to sort it out.
 

Attachments

  • Input.JPG
    Input.JPG
    23.9 KB · Views: 10
  • Output.JPG
    Output.JPG
    132.3 KB · Views: 10

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try this:
The script copies only the values not the formatting I assume that is OK
Run this script from Sheet1
VBA Code:
Sub Copy_Each_Row()
'Modified 5/19/2022  5:28:18 AM  EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Dim Lastrowa As Long
Lastrowa = Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row

For i = 1 To Lastrow
    Lastrowa = Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row + 1
Sheets(2).Rows(Lastrowa).Resize(15).Value = Sheets(1).Rows(i).Value
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,852
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top