Copy only part of last row that has data

Nachtschade

New Member
Joined
Dec 6, 2013
Messages
30
I have this code:

Code:
Range("A" & Rows.Count).End(xlUp).EntireRow.Copy
Range("A" & Rows.Count).End(xlUp).Offset(1).EntireRow.PasteSpecial

It copies the entire last row that contains data and pastes it one row below.

I only want it to copy part of the row, columns A to I to be exact. How do I edit this?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
See next code ... NOT TESTED

Code:
Cells(rows.count,"A").end(3).resize(1,9).Copy
Range("A" & Rows.Count).End(xlUp).Offset(1).EntireRow.PasteSpecial
 
Last edited:
Upvote 0
Try:

Code:
Dim lastrow As Long
Dim sht As Worksheet


Set sht = ActiveSheet


lastrow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row


Range("A" & lastrow & ":I" & lastrow).Copy
Range("A" & lastrow + 1).PasteSpecial
 
Upvote 0
a smarter one

Code:
    With Cells(Rows.Count, "A").End(3)
        .Resize(1, 9).Copy
        .Offset(1).PasteSpecial
    End With
 
Upvote 0
I also have another question. Not sure if I should post that here or make a new topic but anyway..

I want to copy an entire column* with offset where the offset is x columns to the right and x is a cell value. The paste needs to be as value.

*Where I say entire column what I actually mean is only the cells in that contain a value in that column (there's always exactly 40 cells with a value).
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,174
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top