Hi,
I need to copy a row and insert x number of times below (thus shifting down the below rows).
The x is a value from another cell.
I am struggling with my code as all I managed to succeed is copying the row and pasting x number of times but it overwrites the below row, it doesn't shift down and I can't find the solution.
Here is my code:
Sub copy_paste_range()
Dim r As Range, i As Long, n As Long
Set r = Range("7:7")
If Not IsNumeric(Range("A2").Value) Then Exit Sub
For i = 1 To Range("A2").Value
n = n + r.Rows.Count
r.Copy r.Offset
Next
End Sub
Thanks for your help!
JJCam
I need to copy a row and insert x number of times below (thus shifting down the below rows).
The x is a value from another cell.
I am struggling with my code as all I managed to succeed is copying the row and pasting x number of times but it overwrites the below row, it doesn't shift down and I can't find the solution.
Here is my code:
Sub copy_paste_range()
Dim r As Range, i As Long, n As Long
Set r = Range("7:7")
If Not IsNumeric(Range("A2").Value) Then Exit Sub
For i = 1 To Range("A2").Value
n = n + r.Rows.Count
r.Copy r.Offset
Next
End Sub
Thanks for your help!
JJCam