VBA & Macro Problems

Move Completed Rows to Another Sheet in Excel VBA With Newest First

Bushra ParveenBushra Parveen Nov 12, 2026 870 views

Question details

Move worksheet rows whose status is marked Completed to another sheet and show the newest completed records first.

Move Completed Rows to Another Sheet in Excel VBA With Newest First
Product
Microsoft Excel VBA macro
Device & OS
not provided
Scenario
A workbook uses a status column to identify completed records and needs to archive or transfer those records to a Completed worksheet.
Observed behavior
Completed rows need to be transferred without skipping records, with the most recently completed items displayed at the top of the destination sheet.
Before you start

Confirm the source and destination worksheet names, the column containing the Completed status, and whether row 1 contains headers. If newest order is based on a date, ensure every transferred row has a valid completion date in the same date column.

Solution 1Recommended

Move completed rows from bottom to top and insert them below the destination header

Use this approach when the source list is already in chronological order and you want each newly moved completed row to appear at the top of the Completed sheet.

Looping from the last source row upward prevents the macro from skipping rows after it deletes a moved row. Inserting each record at row 2 keeps the header in row 1 and places the latest processed record first.

1
Open the VBA editor and add a module

In Excel, press Alt+F11, select Insert > Module, and paste the macro into the new code module.

2
Set your worksheet names and status column

Update the code references such as Worksheets("Active") and Worksheets("Completed") to match your workbook. Change the status-column reference Cells(r, "G") if Completed is stored in another column.

3
Use a bottom-up move macro

Paste and run this macro from the VBA editor: Sub MoveCompletedRows()\n Dim wsSource As Worksheet, wsCompleted As Worksheet\n Dim lastRow As Long, r As Long\n\n Set wsSource = Worksheets("Active")\n Set wsCompleted = Worksheets("Completed")\n lastRow = wsSource.Cells(wsSource.Rows.Count, "A").End(xlUp).Row\n\n For r = lastRow To 2 Step -1\n If LCase(Trim(wsSource.Cells(r, "G").Value)) = "completed" Then\n wsCompleted.Rows(2).Insert Shift:=xlDown\n wsSource.Rows(r).Copy Destination:=wsCompleted.Rows(2)\n wsSource.Rows(r).Delete\n End If\n Next r\nEnd Sub

4
Run and verify the result

Press F5 while the cursor is inside MoveCompletedRows, or return to Excel and select Developer > Macros > MoveCompletedRows > Run. Confirm that completed records are on the Completed sheet directly below its header.

Move completed rows from bottom to top and insert them below the destination header
Order depends on the source list: This method puts the last matching row in the source sheet at the top of the destination sheet. If the source rows are not ordered by completion time, sort the destination by a completion-date column instead.
Work efficiently with WPS Spreadsheet

Organize Completed Records With WPS Spreadsheet Macros and Sorting

WPS Spreadsheet provides familiar worksheet tools for marking completed items, transferring records with supported macros, and sorting a completion-date column so the newest records remain at the top.

  1. 1. Open the workbook in WPS Spreadsheet: Launch WPS Office, select Spreadsheets, and open the Excel workbook containing your status and completion-date columns.
  2. 2. Check the status and destination sheets: Verify the source worksheet, the Completed worksheet, and the column where users enter Completed.
  3. 3. Run or edit the macro: Open the macro or VBA editor available in your WPS Spreadsheet edition, update the worksheet and column references, then run the completed-row procedure.
  4. 4. Sort the completed records by date: On the Completed sheet, select the completed data table and choose Data > Sort, then set the completion-date column to descending order.
Use spreadsheet macros to automate completed-row workflows.Sort completion dates from newest to oldest with the Data tools.Open and edit Microsoft Excel .xlsx and .xls workbooks with format compatibility.Use a familiar spreadsheet interface for formulas, filters, tables, and status tracking.
microsoft office alternative - wps office

Frequently Asked Questions

Why should the macro loop from the last row to the first row?

Deleting a source row shifts all rows below it upward. A loop such as For r = lastRow To 2 Step -1 avoids skipping the next record after a deletion.

How do I keep the headers on the Completed sheet?

Keep headers in row 1 and insert or copy transferred records into row 2. For example, use wsCompleted.Rows(2).Insert before copying the completed source row.

Can I copy completed rows without deleting them from the original sheet?

Yes. Remove or comment out the line wsSource.Rows(r).Delete from the macro. The record will remain on the source sheet after it is copied to the Completed sheet.

What if my Completed status is not in column G?

Change Cells(r, "G") in the status test to the correct column letter or use a column number. For example, Cells(r, "D") checks column D.

How can I make sure the newest completed item is first?

If source rows are already ordered by completion time, insert each moved record at row 2 while looping from bottom to top. Otherwise, use Data > Sort on the Completed sheet and sort the Completion Date column from Newest to Oldest.