How to copy and insert row multiple times or duplicate the row x times in Excel?
In your daily work, have you ever tried to copy a row or each row and then insert multiple times below the current data row in a worksheet? For example, I have a range of cells, now, I want to copy each row and paste them 3 times to the next row as following screenshot shown. How could you deal with this job in Excel?
![]() | ![]() | ![]() |
- Copy and insert a specific row multiple times with VBA code
- Copy and insert each row multiple times with VBA code
- Copy and insert each row multiple times based on a specific number with an awesome feature
Copy and insert a specific row multiple times with VBA code
If you want to duplicate only one specific row x times, the following VBA code may help you, please do as this:
1. Specify a row which you want to copy and insert multiple times, and then hold down the ALT + F11 keys, then it opens the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Duplicate one specific row multiple times:
Sub test()
'Updateby Extendoffice
Dim xCount As Integer
LableNumber:
xCount = Application.InputBox("Number of Rows", "Kutools for Excel", , , , , , 1)
If xCount < 1 Then
MsgBox "the entered number of rows is error, please enter again", vbInformation, "Kutools for Excel"
GoTo LableNumber
End If
ActiveCell.EntireRow.Copy
Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(xCount, 0)).EntireRow.Insert Shift:=xlDown
Application.CutCopyMode = False
End Sub
3. After pasting the code, please press F5 key to run this code, and a prompt box is popped out to remind you to enter the number of times that you want to duplicate, see screenshot:
4. Then click OK button, and three new copied rows have been inserted below the selected row, see screenshot:
Copy and insert each row multiple times based on a specific number easily
Normally, there is not a good method for copying and inserting rows multiple times except dealing with manually copy and insert. But, with Kutools for Excel's Duplicate Rows / columns based on cell value feature, you can solve this problem with ease. Click to download Kutools for Excel!
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!
Copy and insert each row multiple times with VBA code
To duplicate each rows multiple times in a range, you can apply the following VBA code, please do as below:
1. Hold down the ALT + F11 keys, then it opens the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Duplicate each row multiple times:
Sub insertrows()
'Updateby Extendoffice
Dim I As Long
Dim xCount As Integer
LableNumber:
xCount = Application.InputBox("Number of Rows", "Kutools for Excel", , , , , , 1)
If xCount < 1 Then
MsgBox "the entered number of rows is error ,please enter again", vbInformation, "Kutools for Excel"
GoTo LableNumber
End If
For I = Range("A" & Rows.CountLarge).End(xlUp).Row To 2 Step -1
Rows(I).Copy
Rows(I).Resize(xCount).Insert
Next
Application.CutCopyMode = False
End Sub
3. And then press F5 key to run this code, and a prompt box is popped out to remind you to enter the number of times that you want to duplicate for each record, see screenshot:
4. Then click OK, and each row has been copied and inserted 3 times below the active ones, see screenshot:
![]() | ![]() | ![]() |
Note: In the above code, the A indicates the data range is started at column A, if your data starts at column K, please change A to K as your need.
Copy and insert each row multiple times based on a specific number with an awesome feature
Maybe, you are not familiar with the VBA code,or worry about the code will crash your data. Here, I will introduce a useful feature, Kutools for Excel's Duplicate Rows / Columns based on cell value, with this utility, you can quickly copy and insert the rows based on the number you specified.
Tips:To apply this Duplicate Rows / Columns based on cell value feature, firstly, you should download the Kutools for Excel, and then apply the feature quickly and easily.
After installing Kutools for Excel, please do as this:
1. Enter the repeat numbers that you want to duplicate rows in a list of cells beside your data, see screenshot:
2. Click Kutools > Insert > Duplicate Rows / Columns based on cell value, see screenshot:
3. In the Copy and insert rows & columns dialog box, select Copy and insert rows option in the Type section, then select the data range you want to duplicate, and then specify the repeat time to duplicate the rows, see screenshot:
4. Then, click Ok or Apply button, you will get the following result as you need:
![]() | ![]() | ![]() |
Click to Download Kutools for Excel and free trial Now!
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!