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Ĭopy 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:ġ. 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.Ģ. MsgBox "the entered number of rows is error, please enter again", vbInformation, "Kutools for Excel" XCount = Application.InputBox("Number of Rows", "Kutools for Excel",, , 1) VBA code: Duplicate one specific row multiple times: Sub test()Ĭlick Insert > Module, and paste the following code in the Module Window. Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(xCount, 0)).EntireRow.Insert Shift:=xlDownģ. Then click OK button, and three new copied rows have been inserted below the selected row, see screenshot:Ĭopy and insert each row multiple times based on a specific number easily 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:Ĥ. 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. #Madruby play macro multiple times codeĭownload and free trial Now!Ĭopy and insert each row multiple times with VBA code Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 60 days. To duplicate each rows multiple times in a range, you can apply the following VBA code, please do as below:ġ. VBA code: Duplicate each row multiple times: Sub insertrows() Hold down the ALT + F11 keys, then it opens the Microsoft Visual Basic for Applications window. MsgBox "the entered number of rows is error ,please enter again", vbInformation, "Kutools for Excel"įor I = Range("A" & Rows.CountLarge).End(xlUp).Row To 2 Step -1ģ. #Madruby play macro multiple times codeĪnd 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:Ĥ.#Madruby play macro multiple times how to.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |