Hi guys, I would like to find an alternative to my code which doesnt work properly at the moment.
Private Sub CleanUpList()
Dim CompletedOrderRow As Long, j
j = 2
'loop - check if R is entered in list until it reaches an empty row
Do Until Range("L" & j) = ""
If Range("L" & j) = "D" Then
'move order to Completed Orders list
CompletedOrderRow = Sheets("Completed Orders").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("Completed Orders").Cells(CompletedOrderRow, 1).Value = Range("A" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 2).Value = Range("B" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 3).Value = Range("C" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 4).Value = Range("D" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 5).Value = Range("E" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 6).Value = Range("F" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 7).Value = Range("G" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 8).Value = Range("H" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 9).Value = Range("I" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 10).Value = Range("J" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 11).Value = Range("K" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 12).Value = Range("L" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 13).Value = Range("M" & j).Value
Sheets("Completed Orders").Cells(CompletedOrderRow, 14).Value = Range("N" & j).Value
'delete the row
Cells(j, 1).EntireRow.Delete
'next row
j = j + 1
'if no R try next row
Else
j = j + 1
End If
Loop
End Sub
I need an efficient code which will copy all the rows with "D" in cell in column L to another sheet (CompeletedOrders) and then delete the rows in Orders sheet.
Please assist with this, Cheers.
Bookmarks