Macro to repeat a row n times

Closed
Shorouq Posts 2 Registration date Friday October 30, 2015 Status Member Last seen October 31, 2015 - Oct 30, 2015 at 10:40 AM
Shorouq Posts 2 Registration date Friday October 30, 2015 Status Member Last seen October 31, 2015 - Oct 31, 2015 at 04:00 AM
Hello,
I want a macro to repeat a row n times.

Example
A B C

if n=2

A B C
A B C

Thanks in advance

2 responses

Blocked Profile
Oct 30, 2015 at 05:41 PM
So post the code that you have, and we can help. We cannot provide you with a turn key solution but can help when stuck.

Are you familiar with IF....Then? How about For Loops?

If N !=0 {
FOR var t = 0 to N {
DO_THE_ACTION
}
NEXT T
}

Please understand, this code is not VBA, or basic. but just a wireframe of how the logic could go. I am excited to see what you have!

I have said it once, I will say it again. IT!
0
Shorouq Posts 2 Registration date Friday October 30, 2015 Status Member Last seen October 31, 2015
Oct 31, 2015 at 04:00 AM
Hi back,

I have this script
Sub NumberOfActivities()
'
' Rows Macro
' Repeat numbers of rows
'
Dim sh As Worksheet, lr As Long
Set sh = Sheets(1)
lr = sh.Cells(Rows.Count, 1).End(xlUp).Row
mult = InputBox("Enter number of activities", "MULTIPLIER")
For i = lr To i Step -1
sh.Cells(5, 1).Resize(1, 9).Copy
sh.Cells(5, 1).Resize(CInt(mult) - 1, 9).Insert Shift:=xlDown
Next
'
End Sub


it can enter number of activities only one time as the second time the number will be minus 1 ,i want to change this, to be able to add more activities without calculating the first one.

Thanks in advance
0