ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting rows (https://www.excelbanter.com/excel-programming/400492-inserting-rows.html)

Francis Hookham

Inserting rows
 
Varable iR is the row where I need to insert a row.
Given iCount is the numbers of rows to be inserted, how can this be altered
to insert that number of rows?

Sheets("Pages").Rows(iR + 1).EntireRow.Insert

The following does it but is so cumbersome, having to select first:

Cells(iR+ 2, 1).Select
ActiveCell.Rows("1:" & iCount).EntireRow.Select
Selection.Insert Shift:=xlDown

Many thanks
Francis Hookham



Michael

Inserting rows
 
Doing this wil speed up the insertion because is not selecting:

Cells(ir + 2, 1).Rows("1:" & icount).EntireRow.Insert Shift:=xlDown


--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Francis Hookham" wrote:

Varable iR is the row where I need to insert a row.
Given iCount is the numbers of rows to be inserted, how can this be altered
to insert that number of rows?

Sheets("Pages").Rows(iR + 1).EntireRow.Insert

The following does it but is so cumbersome, having to select first:

Cells(iR+ 2, 1).Select
ActiveCell.Rows("1:" & iCount).EntireRow.Select
Selection.Insert Shift:=xlDown

Many thanks
Francis Hookham




Francis Hookham

Inserting rows
 
Fantastic Michael - just what I wanted - many thanks,

Francis


"Michael" wrote in message
...
Doing this wil speed up the insertion because is not selecting:

Cells(ir + 2, 1).Rows("1:" & icount).EntireRow.Insert Shift:=xlDown


--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Francis Hookham" wrote:

Varable iR is the row where I need to insert a row.
Given iCount is the numbers of rows to be inserted, how can this be
altered
to insert that number of rows?

Sheets("Pages").Rows(iR + 1).EntireRow.Insert

The following does it but is so cumbersome, having to select first:

Cells(iR+ 2, 1).Select
ActiveCell.Rows("1:" & iCount).EntireRow.Select
Selection.Insert Shift:=xlDown

Many thanks
Francis Hookham







All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com