How do I add a row below certain row and keep adding new ones below that

thamestowers

New Member
Joined
Jun 8, 2014
Messages
23
I have been trying to complete the macro to add a new row below an specific one, it is a very simple code, but so far I haven't found the condition to keep on adding new ones below the newly added row.

For example:
I am copying the data from the row 29 and pasting it on the 30, (as it has formulas, I do a second copy of the formulas and paste it)
Now, is it possible to make my next insert to be on the row 31, then the next on 32 and so on...?

'inserting new row
Range("A29:AB29").EntireRow.Offset(1, 0).Insert
'getting the formulas from the previous row
Range("X29:AB29").Copy Destination:=Range("X30:AB30")

and here is where I have been stuck to make it consecutive...
thank you in advance for your advice and assistance!
 
Not an answer as such as I struggle to make these work but you need a For Next Loop

so i = 29 to 35 step 1
your code here
next i


and that would work 6 times and exit, plenty of worked examples on here, but I'm not the best to write them
 
Upvote 0
This example will insert six new rows and fill the formulas.

Code:
    [color=green]'insert six new rows[/color]
    Range("X29").EntireRow.Offset(1, 0).Resize(6).Insert
    [color=green]'paste to new rows[/color]
    Range("X29:AB29").AutoFill _
        Destination:=Range("X29:AB29").Resize(7)
 
Upvote 0

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