RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 810
- Office Version
- 365
- Platform
- 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.
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.
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: