Calculation Issues

Fix Excel INDIRECT #NUM Errors After VBA Calculation

Phi Hung VoPhi Hung Vo Nov 22, 2026 868 views

Question details

The user needs to resolve an INDIRECT formula error and update dependent formulas after an external data refresh controlled by VBA.

Fix Excel INDIRECT #NUM Errors After VBA Calculation
Product
Microsoft Excel
Device & OS
not provided
Scenario
External worksheet data is refreshed while calculation is controlled through VBA.
Observed behavior
A volatile INDIRECT formula may return #NUM, and dependent formulas may remain out of date when calculation is manual or disabled on a worksheet.
Before you start

Identify the worksheets that contain the INDIRECT formula and its dependent formulas, and confirm that the external data refresh has finished before recalculating. Open the VBA editor and locate the code that controls worksheet calculation.

Solution 1Recommended

Enable Worksheet Calculation and Force a Full Recalculation

Use this approach after the external data refresh completes to recalculate formulas on the affected worksheets.

1
Wait for the refresh

Run your external data refresh and confirm that it has completed before continuing. If the connection refreshes in the background, use its completion mechanism rather than assuming RefreshAll has finished when it returns.

2
Enable affected worksheets

In the VBA editor, add code after the refresh completes to set EnableCalculation to True for each affected worksheet. For sheets in the workbook containing the macro, use: For Each ws In ThisWorkbook.Worksheets: ws.EnableCalculation = True: Next ws. Declare ws as a Worksheet in the procedure.

3
Recalculate all formulas

After enabling the worksheets, run Application.CalculateFull in the VBA procedure. This forces a full calculation of all open workbooks, including those in manual calculation mode.

4
Rebuild dependencies if needed

If formulas still appear out of date, run Application.CalculateFullRebuild after the refresh instead. It rebuilds formula dependencies as well as performing a full calculation, so it may take longer.

5
Review the calculation code

Check the VBA procedure for statements that set a dependent worksheet's EnableCalculation property to False before the refresh and recalculation are complete. Remove or move those statements as appropriate, then test the refresh again.

Enable Worksheet Calculation and Force a Full Recalculation
Check other open workbooks: The worksheet loop shown covers ThisWorkbook only. If dependent sheets are in another workbook, enable calculation for those sheets too.
Free Microsoft Office alternative

Work with Spreadsheet Formulas in WPS Office

WPS Office is a free, lightweight alternative for everyday spreadsheet work, with a familiar interface and support for common Excel formats to make moving files easier. It does not repair Microsoft Excel's VBA calculation behavior, and macro compatibility should be tested before migrating an automated workbook.

Create and review spreadsheet formulas in a familiar interfaceOpen and save common Microsoft Excel formats, including XLSX and XLSUse free spreadsheet tools for everyday editingMove compatible Office documents into a lightweight suite
microsoft office alternative - wps office

Frequently Asked Questions

What is the difference between CalculateFull and CalculateFullRebuild?

Application.CalculateFull forces a full calculation of all open workbooks. Application.CalculateFullRebuild also rebuilds formula dependencies, which can help when dependencies appear out of date but may take longer.

Why are formulas still out of date after a refresh?

The refresh may still be running, or calculation may be disabled on a dependent worksheet. Confirm that the refresh has completed, set each affected worksheet's EnableCalculation property to True, and then run Application.CalculateFull.

Does an invalid INDIRECT reference always return #NUM?

No. An invalid reference commonly returns #REF!. Select the formula and use Formulas > Evaluate Formula to check the reference and other parts of the calculation for the source of #NUM.

Can INDIRECT refer to a closed Excel workbook?

Excel INDIRECT references to external workbooks generally require the source workbook to be open. Open the source workbook and check the workbook, sheet, and range names in the reference.