Copy and Paste rows down using macros

kam4b7

New Member
Joined
Oct 31, 2017
Messages
6
I am trying to copy each row and insert the copied cell down 11 times in the same worksheet using macros. I am an extreme beginner when it comes to VBA. So I appreciate the help if anyone knows how to execute this code to get this to work.

Example is below:

Before:
A A A A
B B B B
C C C C
D D D D


After:
A A A A
A A A A
A A A A
A A A A
............ x11 for a total of 12 A A A A rows
B B B B
B B B B
........... x11 for a total of 12 B B B B rows
C C C C
C C C C
........... x11 for a total of 12 C C C C rows

and so on.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
try

Code:
Sub copydown()
Dim lr As Long
Dim ft As Boolean
lr = Cells(Rows.Count, 1).End(xlUp).Row
ft = True
For x = lr To 1 Step -1
    If ft = True Then
        ft = False
        Rows(x).EntireRow.Copy Cells(x + 1, 1).Resize(11)
    Else
        Rows(x + 1 & ":" & x + 11).EntireRow.Insert
        Rows(x).EntireRow.Copy Cells(x + 1, 1).Resize(11)
    End If
Next x

End Sub
 
Upvote 0
try
Code:
Sub copyDownRw()

    Dim cnt As Long
    
    For cnt = Range("A" & Rows.Count).End(xlUp).Row To 1 Step -1
        Rows(cnt + 1).Resize(11).Insert
        Rows(cnt).Resize(12).FillDown
    Next cnt

End Sub
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,226,117
Messages
6,189,068
Members
453,524
Latest member
AshJames

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top