Macro to Insert Copied Rows

Ashley1432

New Member
Joined
Aug 10, 2017
Messages
8
Hey All, I'm sure this has been answered 100 times but I can't find anything that is helping me really. I have data in row 23 that I want to copy and paste down X many times based on the number found in cell B15.

Any help is appreciated.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
How about
Code:
Sub CopyDown()
   With Range("B15")
      Rows(26).Resize(.Value).Insert
      Rows(25).Resize(.Value + 1).FillDown
   End With
End Sub
 
Upvote 0
Fluff, I think you have a small typo in your code. It is row 23 that they want to copy down, so I think your code should be:
Code:
Sub CopyDown()
   With Range("B15")
      Rows([COLOR=#ff0000]24[/COLOR]).Resize(.Value).Insert
      Rows([COLOR=#ff0000]23[/COLOR]).Resize(.Value + 1).FillDown
   End With
End Sub
 
Upvote 0
Good spot Joe4, thanks for that :)
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

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