Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting Variable Number of Rows


I'm trying to create a chunk of code that copies an entire row and then
inserts a variable amount. here is the code

insertrows = 3 + prodlength
Rows("3:3").Select
Selection.Copy
Rows("4:insertows").Select
Selection.Insert Shift:=xlDown

Is it possible to do something like this? I'm trying to do this method
because it copying and inserting rows preserves all the formatting. The
variable prodlenght is the number of products found off another
worksheet in the workbook.


--
bundyloco
------------------------------------------------------------------------
bundyloco's Profile: http://www.excelforum.com/member.php...o&userid=23386
View this thread: http://www.excelforum.com/showthread...hreadid=399996

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Inserting Variable Number of Rows

Would you consider replacing
Rows("4:insertows").Select
Selection.Insert Shift:=xlDown


with
Rows("4:insertows").entirerow.insert

"bundyloco" wrote:


I'm trying to create a chunk of code that copies an entire row and then
inserts a variable amount. here is the code

insertrows = 3 + prodlength
Rows("3:3").Select
Selection.Copy
Rows("4:insertows").Select
Selection.Insert Shift:=xlDown

Is it possible to do something like this? I'm trying to do this method
because it copying and inserting rows preserves all the formatting. The
variable prodlenght is the number of products found off another
worksheet in the workbook.


--
bundyloco
------------------------------------------------------------------------
bundyloco's Profile: http://www.excelforum.com/member.php...o&userid=23386
View this thread: http://www.excelforum.com/showthread...hreadid=399996


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Inserting Variable Number of Rows

insertrows = 3 + prodlength
Rows("3:3").Copy
Rows("4:" & insertrows).Insert

--

HTH

RP
(remove nothere from the email address if mailing direct)


"bundyloco" wrote
in message ...

I'm trying to create a chunk of code that copies an entire row and then
inserts a variable amount. here is the code

insertrows = 3 + prodlength
Rows("3:3").Select
Selection.Copy
Rows("4:insertows").Select
Selection.Insert Shift:=xlDown

Is it possible to do something like this? I'm trying to do this method
because it copying and inserting rows preserves all the formatting. The
variable prodlenght is the number of products found off another
worksheet in the workbook.


--
bundyloco
------------------------------------------------------------------------
bundyloco's Profile:

http://www.excelforum.com/member.php...o&userid=23386
View this thread: http://www.excelforum.com/showthread...hreadid=399996



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
Linking to a Variable Number of Rows - XP/07 RFJ Excel Worksheet Functions 4 May 17th 07 07:53 PM
INserting Specific Number of Rows via macro [email protected] Links and Linking in Excel 1 November 14th 06 09:56 PM
Same operations on a variable number of rows Matt Silberstein Excel Programming 5 April 6th 05 04:40 PM
Inserting a variable number of rows in a worksheet kls[_2_] Excel Programming 1 August 20th 04 01:47 PM
deleting variable number of rows Nick Excel Programming 1 October 29th 03 04:31 PM


All times are GMT +1. The time now is 11:05 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"