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 :)
 

HarryJT

New Member
Joined
Jul 21, 2021
Messages
7
Office Version
  1. 365
Platform
  1. Windows
That has solved the problem. oops. Thanks very much for your help
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,664
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
1,147,635
Messages
5,742,250
Members
423,717
Latest member
rubthenut

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
Top