How do I copy several rows from one sheet to another?

S

Saucer Man

I am currently doing...

ActQty.Entirerow.Copy Destination:=Sheets(1).Cells(.Rows.Count,
"A").End(xlUp).Offset(1,0)

....but the copied rows are copied to the bottom of the destination sheet.

I want the copied rows to start at row 15 of the destination sheet, not the
bottom. I also want just the data copied. I do not want the copied rows to
wipe out my cell formatting on the destination sheet.

Thanks!
 
S

Saucer Man

Great. If I put this in a loop, how do I make it so the next time through
the loop, the line is copied to row 16, etc.? I know I can replace the 15
with a variable and increment it but is there a easier way with a keyword?


"Jim Cone" wrote in message
ActQty.EntireRow.Copy
Sheets(1).Cells(15, 1).PasteSpecial Paste:=xlPasteValues
 
J

Jim Cone

Sheets(1).Rows("15:30").Value = ActQty.EntireRow.Value
--or--

Dim x as Long
For x = 15 to 30
ActQty.EntireRow.Copy
Sheets(1).Cells(x, 1).PasteSpecial Paste:=xlPasteValues
Next
--or--

ActQty.EntireRow.Copy
Sheets(1).Rows("15:30").PasteSpecial xlPasteValues
'----
Jim Cone
Portland, Oregon USA .
http://www.mediafire.com/PrimitiveSoftware .
(List Files XL add-in: finds and lists files/folders with hyperlinks)
 
S

Saucer Man

Thanks. The middle example is working best as the others just copy the same
line 15 times. However, I discovered that copying the entire row is wiping
out a formula in the sheet being copied to. How can I copy just columns 1
through 4?


"Jim Cone" wrote in message
Sheets(1).Rows("15:30").Value = ActQty.EntireRow.Value
--or--

Dim x as Long
For x = 15 to 30
ActQty.EntireRow.Copy
Sheets(1).Cells(x, 1).PasteSpecial Paste:=xlPasteValues
Next
--or--

ActQty.EntireRow.Copy
Sheets(1).Rows("15:30").PasteSpecial xlPasteValues
'----
Jim Cone
Portland, Oregon USA .
http://www.mediafire.com/PrimitiveSoftware .
(List Files XL add-in: finds and lists files/folders with hyperlinks)
 
S

Saucer Man

The Resize command worked great. Thanks Jim for all your help.


"Jim Cone" wrote in message

Check out the Resize property in Excel VB help.
'---
Jim Cone
Portland, Oregon USA .
http://www.mediafire.com/PrimitiveSoftware .
(XL Companion add-in: compares, matches, counts, lists, finds, deletes...)
 

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