Vba Code too copy and paste

DelusionalTuck

New Member
Joined
Jun 6, 2017
Messages
20
Ok so here is what I have.
I have a invoice spreadsheet with multiple tabs and it is starting to get lengthy.
I have a column for delivered machines, simple yes or no.
I want to copy the row where machines delivered "Yes" and paste to another sheet then delete the row when done. I
First sheet is "Invoice Details" the new sheet is "Closed out Invoices".
The delivered column is "O"
On the new sheet I want it to find the last row and enter the delivered ones underneath that.

I have much more to do with all of this but I think I can manage once I get this done.

Thank you for anyone that can help me.

Tuck
 
Last edited:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try
Code:
Sub movedeliv()
Dim id As Worksheet
Dim ci As Worksheet
Dim lrid As Long
Dim lrci As Long
Set id = Sheets("Invoice Details")
Set ci = Sheets("Closed out Invoices")
lrid = id.Cells(Rows.Count, 15).End(xlUp).Row
lrci = ci.Cells(Rows.Count, 15).End(xlUp).Row
For x = lrid To 2 Step -1
    If UCase(id.Cells(x, 15)) = "YES" Then
    id.Cells(x, 1).EntireRow.Copy ci.Cells(lrci + 1, 1)
    id.Rows(x).Delete Shift:=xlUp
    lrci = ci.Cells(Rows.Count, 15).End(xlUp).Row
    End If
Next x
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,366
Members
449,080
Latest member
Armadillos

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