Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selection copy and insert to other sheet (Macro) VLOOKUP fORMULA Excel Discussion (Misc queries) 8 March 27th 10 02:48 PM
Selection copy and insert to other sheet VLOOKUP fORMULA Excel Discussion (Misc queries) 1 March 23rd 10 05:29 PM
Insert Row Selection VLOOKUP fORMULA Excel Worksheet Functions 2 June 19th 09 04:44 AM
Excel hangs on 'shtA.Cells(person_row, 1).EntireRow.Insert' comman Gordon[_2_] Excel Programming 1 July 14th 06 08:00 AM
Insert Picture from dropdown selection Mike at Channel New Users to Excel 21 March 22nd 06 01:14 AM


All times are GMT +1. The time now is 08:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"