Transfer Only Edited or New Excel Rows to Another Worksheet
Question details
The user needs to extract and transfer only new, modified, or deleted records from a large Excel dataset to another worksheet to speed up daily database exports.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Exporting daily updates from a large staff list to another database without processing the entire worksheet.
- Observed behavior
- Manually copying thousands of rows or processing the complete worksheet is too slow and inefficient. The goal is to automate the extraction of changed data.
Ensure your worksheet has a column with unique identifiers (such as Employee IDs) to accurately compare records, and save a backup copy of your workbook before running any macros.
Use a VBA Macro to Identify and Transfer New Rows
A VBA script can automatically compare your source sheet against a destination sheet using unique IDs, transferring only the rows that do not yet exist in the destination.
Formulas alone cannot detect or log worksheet changes over time. Using VBA (Visual Basic for Applications) provides a scalable way to compare records based on a unique identifier and push new or altered records to a staging sheet.
Press ALT + F11 in your Excel workbook to open the Microsoft Visual Basic for Applications window.
Click 'Insert' from the top menu and select 'Module'. Paste your VBA code (like the TransferEditedRows macro) into the blank module window.
Modify the script to match your sheet names (e.g., 'SourceSheet' and 'DestinationSheet') and ensure the column references align with your unique ID column (e.g., Column A).
Close the VBA editor, return to your workbook, press ALT + F8, select 'TransferEditedRows', and click 'Run'. Remember to save your file as a Macro-Enabled Workbook (.xlsm).

Use Power Query to Compare Worksheets
Power Query can merge today's list with yesterday's snapshot to quickly isolate rows that are new or have changed.
Automate Data Transfers with WPS Spreadsheet
WPS Spreadsheet provides robust support for VBA macros, Power Query-like data processing, and advanced formulas. You can seamlessly run Excel macros (.xlsm) to automate your daily staff list exports for free.
- 1. Download and Install: Get WPS Office from the official website and install it on your device.
- 2. Open your Workbook: Launch WPS Spreadsheet and open your existing Excel file containing the staff list and VBA macros.
- 3. Enable Macros: Go to the 'Developer' tab, click 'Macros', and run your VBA script to transfer the new or edited rows instantly.

Frequently Asked Questions
Why can't I use standard Excel formulas like VLOOKUP to transfer edited rows?
Formulas update dynamically based on the current state of the worksheet. They cannot store historical data or detect the specific event of a row being edited or deleted, which is required to log changes over time.
Will the VBA macro run automatically when a cell is edited?
A standard macro requires you to run it manually (e.g., by clicking a button). If you want it to run automatically upon editing, you need to use the Worksheet_Change event in VBA, though this may slow down performance for large datasets.
How do I export the isolated changes to my database?
Once your macro or Power Query places the new or edited rows into the destination worksheet, you can save that specific sheet as a CSV file and import it directly into your database system.
What happens if I don't have a unique ID for each row?
Without a unique identifier (like an Employee ID), VBA and Power Query cannot accurately determine if a row is new, modified, or a duplicate. You will need to create a unique key, perhaps by concatenating columns like First Name, Last Name, and Date of Birth.




