VBA & Macro Problems

Copy a Formula Result to Another Sheet with Excel VBA

Tauseeq MagsiTauseeq Magsi Nov 20, 2026 869 views

Question details

Copy the calculated result of the last used formula cell in Sheet1 to the next available row in Sheet2 without copying the formula.

Copy a Formula Result to Another Sheet with Excel VBA
Product
Microsoft Excel VBA
Device & OS
not provided
Scenario
A macro transfers the last used value in Sheet1 column A to Sheet2 column A.
Observed behavior
The existing copy operation transfers the formula rather than only its calculated result.
Before you start

Confirm that the workbook contains sheets named Sheet1 and Sheet2 and that column A is the intended source and destination. If calculation is set to manual, recalculate the workbook before running the macro so the result is current.

Solution 1Recommended

Assign the source cell’s value to the destination with VBA

Use Range.Value to transfer the evaluated result without copying the formula or formatting.

The macro finds the last used cell in Sheet1 column A and appends its value after the last used cell in Sheet2 column A. If the destination column is empty, it uses A1.

1
Open the VBA editor

In Excel, open Developer > Visual Basic, then select Insert > Module in the VBA editor.

2
Add the macro

Paste this code into the module: Sub CopyFormulaResult() Dim srcSheet As Worksheet, dstSheet As Worksheet Dim src As Range, dst As Range Dim lastRow As Long Set srcSheet = ThisWorkbook.Worksheets("Sheet1") Set dstSheet = ThisWorkbook.Worksheets("Sheet2") If Application.WorksheetFunction.CountA(srcSheet.Columns("A")) = 0 Then MsgBox "Sheet1 column A is empty." Exit Sub End If Set src = srcSheet.Cells(srcSheet.Rows.Count, "A").End(xlUp) If Application.WorksheetFunction.CountA(dstSheet.Columns("A")) = 0 Then Set dst = dstSheet.Range("A1") Else lastRow = dstSheet.Cells(dstSheet.Rows.Count, "A").End(xlUp).Row If lastRow = dstSheet.Rows.Count Then MsgBox "Sheet2 column A has no available row." Exit Sub End If Set dst = dstSheet.Cells(lastRow + 1, "A") End If dst.Value = src.Value End Sub

3
Save and run

Save the workbook as an Excel Macro-Enabled Workbook (.xlsm). In Excel, select Developer > Macros, choose CopyFormulaResult, and click Run.

Assign the source cell’s value to the destination with VBA
Values only: The assignment does not copy formatting. If the source formula returns an error, the destination receives that error value.
Free Microsoft Office alternative

Work with Excel spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Excel format compatibility, making it easier to move everyday spreadsheet work between office suites. It does not fix an Excel VBA macro; check macro compatibility before relying on VBA in WPS.

View and edit spreadsheet values and formulasCompatible with common Microsoft Excel formats, including XLSX and XLSFamiliar spreadsheet tools for a smoother transition from ExcelFree, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

How do I copy only a formula’s result in VBA?

Assign the source cell’s value directly to the destination, for example, Dest.Value = Source.Value. This transfers the result without copying the formula.

What happens if Sheet2 column A is empty?

The example checks column A with CountA and writes the result to Sheet2 cell A1 when the column contains no entries.

How can I make sure the copied result is up to date?

If Excel is using manual calculation, recalculate the workbook before running the macro. You can also add Application.Calculate before the value assignment.

Why do I need to save the workbook as XLSM?

The XLSM format retains VBA code. Use File > Save As and choose Excel Macro-Enabled Workbook before closing the workbook.