Trouble cutting and pasting a range of cells from one worksheet to another.

HarryJT

New Member
Joined
Jul 21, 2021
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I have used and adapted code from another thread on the site however there was errors regarding the size of copy and paste due to using EntireRow. On one sheet I have a data validation list of either outstanding or completed with the aim for excel to cut and paste the row to the "Done" worksheet at the bottom of the exisiting database. The existing code I have reads as follows.

Sub fromOutstanding()
' Move rows from Outstanding to Completed If Column K has a Completed in it.
lastrow = Worksheets("To Do").UsedRange.Rows.Count
lastrow2 = Worksheets("Done").UsedRange.Rows.Count
If lastrow2 = 1 Then
lastrow2 = 0
Else
End If

Do While Application.WorksheetFunction.CountIf(Range("K1:K"), "Completed") > 0
Set Check = Range("K1:K" & lastrow)
If Cell = "Completed" Then
For Each Cell In Checkn
Cell.Range("A:K").Copy Destination:=Worksheets("Done").Range("A" & lastrow2 + 1)
Cell.Range("A:K").Delete
lastrow2 = lastrow2 + 1
Else:
End If
Next
Loop

End Sub

Any help would be appreciated :)
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,620
Latest member
dsubash

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