Insert multiple copied rows at fixed intervals

Closed
gizework Posts 6 Registration date Saturday February 24, 2018 Status Member Last seen March 7, 2018 - Updated on Feb 26, 2018 at 04:08 AM
gizework Posts 6 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.
Related:

2 replies

TrowaD Posts 2900 Registration date Sunday September 12, 2010 Status Moderator Last seen September 12, 2022 523
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 6 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
Thanks for the information.
0
TrowaD Posts 2900 Registration date Sunday September 12, 2010 Status Moderator Last seen September 12, 2022 523
Feb 27, 2018 at 11:50 AM
Hi Gizework,

Could you provide some sample data? How it is now and how you want it to look.

Best regards,
Trowa
0
gizework Posts 6 Registration date Saturday February 24, 2018 Status Member Last seen March 7, 2018
Updated on Feb 28, 2018 at 02:39 PM
Hi Trowa
First of all I would like to thank you for your help and for giving me your time. Let the text that I want to copy and insert is Text A in first two rows. Then I need this will be copied like below.
A
1 TextA
2 TextA
3
4
5 Text A
6 TextA
7
8
9 Text A
10 TextA
11
12
13 TextA
14 TextA
.
.
.
Let the letter A on the top designate the excel column and the numbers from 1 up to 14 on the left side of the text designate the rows of excel and the gaps (the rows) that have no Text A is I think the fixed interval. The rows that I want to insert n times like above are 1 and 2 together($1:$2).

With best regards
Gizework
0