Insert multiple copied rows at fixed intervals

Closed
gizework Posts 5 Registration date Saturday February 24, 2018 Status Member Last seen March 7, 2018 - Updated on Feb 26, 2018 at 04:08 AM
gizework Posts 5 Registration date Saturday February 24, 2018 Status Member Last seen March 7, 2018 - Mar 7, 2018 at 12:25 AM
Helo

Would you please help me by giving Solution for my Question how I can insert multiple copied rows n time at fixed interval using excel macros I thank you in advance for best cooperation.

2 responses

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Feb 26, 2018 at 12:23 PM
Hi Gizework,

You aren't very specific. Give this code a try (it's just a start):
Sub RunMe()
Dim sRow As Range
Dim nTimes, fInterval, mLimit, x, y As Integer

Set sRow = Application.InputBox("Select row(s)", Type:=8)

nTimes = InputBox("How many times would you like to insert selected row(s)", "Repeat n times")
fInterval = InputBox("What is the fixed interval?:", "Input fixed interval")
mLimit = InputBox("Input the row you don't want to insert past:?")

Do
    y = y + fInterval
    For x = nTimes To 1 Step -1
        sRow.Copy
        Rows(y).Insert
    Next x
Loop While y < mLimit
End Sub


Best regards,
Trowa
0
Blocked Profile
Feb 26, 2018 at 07:38 PM
I am waiting for the "Change Order"!
0
gizework Posts 5 Registration date Saturday February 24, 2018 Status Member Last seen March 7, 2018
Updated on Feb 27, 2018 at 12:38 AM
I thank you for your help. It worked a little bit with what I intended, but please let me request you one more question what I perfectly need. In my previous question I said Fixed Interval, what i mean this, I want the copied rows to be pasted three or four rows below the selected copied rows and again below three or four rows the next inserted rows repeatedly until n times rows Inserted.. I thank you in advance for your best help.
0