Excel VBA Not Calculating: Fix Guide
In this article
If your Excel VBA code runs but the worksheet formulas don't update, the cause is almost always that automatic calculation is turned off, or your macro never triggers a recalc. The fix is to set Application.Calculation = xlCalculationAutomatic at the start of your macro, or call Application.Calculate (or Worksheet.Calculate) after your code changes cells. Once calculation is back on and you force a full recalc, formulas should update normally.
What You'll Need
- Excel with the Developer tab enabled (File > Options > Customize Ribbon > check Developer).
- Your workbook open, with macros enabled.
- Access to the VBA Editor (Alt+F11).
- A basic idea of where your macro changes cells or formulas.
Step-by-Step
- Check Excel's calculation mode. Go to Formulas > Calculation Options and confirm Automatic is selected. If it's set to Manual, formulas won't recalculate when your VBA changes cells. This is the most common cause.
- Look for code that turns calculation off. Open the VBA Editor with Alt+F11, press Ctrl+F, and search for
Calculation. A line likeApplication.Calculation = xlCalculationManualis often added for speed but never reset. Delete it or add a reset line at the end of the macro:Application.Calculation = xlCalculationAutomatic. - Force a recalculation in your macro. After the lines that change cells, add
Application.Calculatefor a full recalc, orActiveSheet.Calculateto recalc only the active sheet. For a single range, useRange("A1:Z100").Calculate. - Check for disabled calculation in the workbook. In the VBA Editor, look at the Immediate Window (Ctrl+G) and type
?Application.Calculation, then Enter. A result of -4135 means automatic; -4134 means manual. If it's manual, set it back to automatic. - Confirm formulas are actually formulas. If your macro writes values as text (for example, a string starting with an apostrophe), Excel treats them as text, not formulas. Check that cells contain a leading equals sign and no leading apostrophe.
- Check for circular references. A circular reference can stop calculation and show a warning. Go to Formulas > Error Checking > Circular References to see if one is flagged. Fix the formula so it doesn't refer to its own cell.
- Recalculate manually to test. Press F9 (or Ctrl+Alt+F9 for a full rebuild) to force a recalculation. If formulas update now, the problem is in your VBA calculation settings, not the formulas themselves.
- Save and reopen the workbook. Calculation mode is saved with the workbook. If the file was saved in manual mode, it will reopen that way. Set it to automatic, save, and close.
Common Mistakes
- Leaving calculation off after a speed tweak. Many macros set
xlCalculationManualat the start but forget to switch it back, so the workbook stays in manual mode after the macro ends. - Using
Calculatebefore changing cells. The recalc call must come after the code that edits values or formulas, or it recalculates the old state. - Assuming
Calculatefixes everything. If the cell contains text instead of a formula, no amount of recalculating will help. Check the cell's content type. - Ignoring circular references. A circular reference can prevent calculation from completing, and the warning may be suppressed.
- Forgetting that calculation mode is per-workbook. Setting it in one workbook doesn't change another open workbook.
Tips
- Use
Application.CalculateFullwhen you need to rebuild all dependencies, not just recalc changed cells. - If you turn calculation off for speed, always turn it back on in the same macro, ideally with error handling so it resets even if the macro fails.
- Test your macro on a copy of the workbook first, especially if it changes calculation settings.
- Use the Immediate Window to inspect
Application.Calculationbefore and after running your macro. - Keep formulas simple and avoid volatile functions (like NOW or RAND) in large ranges if calculation feels slow.
Troubleshooting
If formulas still don't update after setting calculation to automatic and forcing a recalc, check these in order:
- Is the workbook protected? Protected sheets can block calculation in some cases. Unprotect the sheet (Review > Unprotect Sheet) and test.
- Are there broken links? External links that can't be resolved may cause calculation to stall. Go to Data > Edit Links to check.
- Is the macro actually running? Add a
MsgBoxat the start and end of your macro to confirm it executes fully. - Is Excel in a weird state? Close and reopen Excel, or restart your computer. A corrupted Excel session can ignore calculation settings.
- Check for add-ins. Some add-ins interfere with calculation. Disable add-ins temporarily (File > Options > Add-ins) and test.
- Try a new workbook. If a fresh workbook calculates fine, the issue is specific to your file. Consider rebuilding the workbook or importing sheets into a new one.
Frequently Asked Questions
Why does my VBA code not trigger calculation?
Because Excel's calculation mode is set to manual, or your code doesn't call Calculate after changing cells. Set Application.Calculation = xlCalculationAutomatic and add Application.Calculate after your edits.
How do I force a full recalculation in VBA?
Use Application.CalculateFull for a full rebuild, or Application.Calculate for a standard recalc. CalculateFullRebuild is even more thorough but slower.
Does calculation mode save with the workbook?
Yes, the calculation mode is saved with the workbook. If you save in manual mode, it will reopen in manual mode.
Can a macro turn off calculation and forget to turn it back on?
Yes, that's a common bug. Always reset to automatic at the end of the macro, ideally with error handling.
What if formulas show as text after running a macro?
Your macro likely wrote the formula as a string with a leading apostrophe or as plain text. Ensure the cell value starts with an equals sign and is not formatted as text.
Why does F9 work but my macro doesn't?
F9 forces a recalc manually. If that works, your macro isn't triggering calculation—add a Calculate call or fix the calculation mode.