Inserting Variable Number of Rows

B

bundyloco

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.
 
B

Bob Phillips

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

--

HTH

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top