VBA - Cut from one sheet paste on another, "Cut method of Range class failed"

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
801
Office Version
  1. 365
Platform
  1. Windows
Hello all.

Having this issue now. I was using a standard "Lastrow" declaration but it was putting to the bottom of the table range. Instead I need "Lastrow" to hold the bottom of the active cells in data, and then paste the cut line below it so it appends the table.

Code:
Set F = Worksheets("Flights")Set C = Worksheets("Cancellations")


F.Activate


Dim Lastrow As Long




Lastrow = F.ListObjects("Table1").Range.Columns(1).Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row




C.Activate


ActiveCell.EntireRow.Cut F.Range("A2:A" & Lastrow).Offset(1, 0)
ActiveCell.EntireRow.Delete


End If
End If


So it needs to go into F, declare the Last Row, this successfully declares as row 111 (instead of row 240)

Then it switches to C, cuts the row. This successfully cuts (I'm assuming)

Then it pastes in F, on column A's 'Lastrow' which is still held as 111, +1, so paste on 112 which should be the first empty line.

Just to clarify because my wording is awful, I now successfully select the correct last row, but now my cut-paste, which worked before, is not working.


This gives me the above error message, cut method of range class failed :(

Any ideas? Thanks.
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Try
Code:
ActiveCell.EntireRow.Cut F.Range("A" & Lastrow).Offset(1, 0)
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

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