Excel VBA: Append Macro Output Below Existing Data
Question details
The user needs a second VBA procedure to add its results below existing data without overwriting the first procedure's output.
- Product
- Microsoft Excel VBA
- Device & OS
- not provided
- Scenario
- Multiple VBA procedures write results to the same output sheet named Op.
- Observed behavior
- The second procedure resets the output row and overwrites data created by the first procedure.
Check the destination sheet name and identify the column that is always populated for each output row. Review the second procedure for any code that resets the row number or clears the destination range before writing.
Find the next available row before writing VBA output
Use this fix when a second procedure must append records to the existing data on the Op sheet.
The output row must be calculated from the current contents of the destination sheet rather than reset to a fixed row such as 2. The last-used-row method is generally reliable when column A contains a value for every output record.
In Excel, press Alt+F11 to open the Visual Basic Editor, then open the module containing the second VBA procedure.
Replace the fixed row assignment with: rw = Sheets("Op").Cells(Sheets("Op").Rows.Count, 1).End(xlUp).Row + 1
Keep the existing write statements, such as Cells(rw, column).Value, so the procedure starts below the last populated cell in column A.
Return to Excel, use Developer > Macros, and run the procedures in sequence to confirm that the second result appears below the first.
Remove code that clears or resets the destination range
Use this check when the row calculation is correct but earlier output still disappears before the second procedure runs.
Switch to WPS Office for lightweight spreadsheet work
WPS Office provides a free, lightweight spreadsheet alternative with a familiar interface and strong Microsoft Excel format compatibility. It can help you review, edit, and migrate spreadsheet data when you do not need Excel-specific VBA behavior.

Frequently Asked Questions
Why does the second Excel VBA procedure overwrite the first result?
The procedure is usually resetting the output row to a fixed value such as 2, or clearing the destination range before writing. Calculate the next available row on the Op sheet instead.
What VBA code appends output after the last used row?
Use rw = Sheets("Op").Cells(Sheets("Op").Rows.Count, 1).End(xlUp).Row + 1, then write the new values using rw as the row number.
Can I use CurrentRegion to find the next output row?
Yes. For a continuous data region beginning at A1, use rw = Sheets("Op").Cells(1, 1).CurrentRegion.Rows.Count + 1. This method may be unreliable if the region contains blank rows.
Which column should be used with End(xlUp)?
Use a column that is populated for every output record, commonly column A. If column A can be blank, select another consistently filled column or calculate the last used row from the complete output range.
Should the second procedure clear CurrentRegion before appending?
No. Clearing CurrentRegion removes the existing output that you want to preserve. Calculate the next empty row and write the new data below the current region instead.




