macro to insert rows and copy and paste

S

STEVE

Here is a macro that a gentleman created for me and I need
the macro to copy and paste all 5 columns down, and also
it is inserting the number of rows in column D which is
great but I need it to subtract one row from column D
value.
Example of spreadsheet is

customer order# item quantity date price
steve 100001 pepsi 3 06/03/04 10.00
jack 100002 coke 8 06/01/04 25.00
thanks a bunch
 
J

JC

Steve,
I think this is what you are looking for:

Sub insertXrows_copydn()
On Error Resume Next
For i = 16 To 2 Step -1
X = Cells(i, "d") - 1
Y = Range(Cells(i, 1), Cells(i, 6)).Value
Cells(i, "a").Resize(X, 1).EntireRow.Insert
Cells(i, "a").Resize(X, 6).Value = Y
Next i
End Sub
 

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