ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection EntireRow Insert (https://www.excelbanter.com/excel-programming/408225-selection-entirerow-insert.html)

Rob

Selection EntireRow Insert
 
Using Excel 2000.

I need to insert a number of rows and using the following code seems wrong
insomuch that the code is repeated for the number of rows required, is there
a more simple solution?

Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert

Thanks, Rob



Mike H

Selection EntireRow Insert
 
Maybe

Sub stance()
response = InputBox("How many rows to insert")
On Error GoTo enditall
For x = 1 To response
Selection.EntireRow.Insert
Next
enditall:
End Sub

Mike

"Rob" wrote:

Using Excel 2000.

I need to insert a number of rows and using the following code seems wrong
insomuch that the code is repeated for the number of rows required, is there
a more simple solution?

Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert

Thanks, Rob




merjet

Selection EntireRow Insert
 
This will insert multiple rows at once.
Rows("5:7").Insert Shift:=xlDown
You can work with it to better suit what you want.

Hth,
Merjet

Dave Peterson

Selection EntireRow Insert
 
activecell.Resize(5, 1).EntireRow.Insert

Would insert 5 rows.

Rob wrote:

Using Excel 2000.

I need to insert a number of rows and using the following code seems wrong
insomuch that the code is repeated for the number of rows required, is there
a more simple solution?

Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert

Thanks, Rob


--

Dave Peterson

Rob

Selection EntireRow Insert
 
Thanks for the recommendations, have used Dave's as it best fitted my needs.
Like the idea of looping and will use this for another routine.

Regards, Rob
"Dave Peterson" wrote in message
...
activecell.Resize(5, 1).EntireRow.Insert

Would insert 5 rows.

Rob wrote:

Using Excel 2000.

I need to insert a number of rows and using the following code seems
wrong
insomuch that the code is repeated for the number of rows required, is
there
a more simple solution?

Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert

Thanks, Rob


--

Dave Peterson





All times are GMT +1. The time now is 01:09 AM.

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