adding rows

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
It depends!
Do you want to add the rows starting at a specific row, at the bottom, at the top?

Michael
 

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
This right here:
Code:
Range("A5:A40").Select
    Selection.Insert Shift:=xlDown

will do what you say.
It starts at cell A5 and adds 35 rows.

Michael
 

claudehollett

Board Regular
Joined
Dec 11, 2003
Messages
89
This works well.
I have 3 header rows and 3 footer or total rows (for a total of 41 rows to be printed). Adding 35 rows keeps my page formatted for printing. When I add the new rows my 3 total row get pushed down (which is fine; I don't want them in the middle anyway). What code will get my page to break after row 38 to keep 35 data rows on the first page? Thanks
 

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
This will add a page break at cell A38

Range("A39").Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell

Michael
 

Forum statistics

Threads
1,141,720
Messages
5,708,090
Members
421,545
Latest member
TWR

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
Top