Fix Excel INDIRECT #NUM Errors After VBA Calculation
Question details
The user needs to resolve an INDIRECT formula error and update dependent formulas after an external data refresh controlled by VBA.

- 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.
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.
Enable Worksheet Calculation and Force a Full Recalculation
Use this approach after the external data refresh completes to recalculate formulas on the affected worksheets.
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.
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.
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.
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.
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.

Check the INDIRECT Reference and Consider a Nonvolatile Formula
Use this if a full recalculation does not resolve the error or if the workbook has many volatile INDIRECT formulas.
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.

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.




