How To Copy And Insert Row Multiple Times Or Duplicate The Row XX Times In Excel?
I want to copy each row and paste them 3 times then follow this method.
Steps
01 open Excel
Press Alt+F11 in excel
then you can see below window
Go to Insert
then Paste this code here
Sub CopyRow()
'UpdatebyExtendoffice
Dim xRg As Range
Dim xCRg As Range
Dim xFNum As Integer
Dim xRN As Integer
On Error Resume Next
SelectRange:
xTxt = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Select the list of numbers to copy the rows based on: ", "Kutools for Excel", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
If xRg.Columns.Count > 1 Then
MsgBox "Please select single column!"
GoTo SelectRange
End If
Application.ScreenUpdating = False
For xFNum = xRg.Count To 1 Step -1
Set xCRg = xRg.Item(xFNum)
xRN = CInt(xCRg.Value)
With Rows(xCRg.Row)
.Copy
.Resize(xRN).Insert
End With
Next
Application.ScreenUpdating = True
End Sub
select your data range
5 Comments
I used it and it worked! Sooooooooooooooooo helpful! Thank you very much!
ReplyDeleteyour welcome
DeleteI want to copy each row and paste them 1 times. I don't understand the code. Can you please tell me how can I do?
ReplyDeleteYou are my lifesaver. Thanks for sharing.
ReplyDeleteHi if the number of times is far greater, then how to improve performance issue?
ReplyDelete