Cut&Paste last row

Gregfox

Board Regular
Joined
Apr 12, 2011
Messages
120
Hi, I’m trying to cut from a sheet (A1 to B1), and paste it to the last blank row in Excel 2007. The code below that I’m using errors out. Where am I going wrong?
Thank you.

Rich (BB code):
Sub FindLastRow()
Dim LastRow As Long
 
Range("A1:B1").Select
Selection.Copy
 
If WorksheetFunction.CountA(Cells) > 0 Then
 
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
ActiveSheet.Paste
End If
End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi,

Here is some code that may help. It will copy your cells from sheet1 to sheet2 last row.

Code:
Sub FindLastRow()

 
Sheets("Sheet1").Range("A1:B1").Copy Destination:=Sheets("Sheet2").Range("A" & Range("A65536").End(xlUp).Row + 1)

 
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

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