How to Fix Excel IMAGE Function #CALC! Errors When Using VBA
Question details
The user needs to resolve a #CALC! error that appears when a VBA macro writes image URLs and IMAGE formulas into cells too quickly.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Automating the insertion of URLs and evaluating the Excel IMAGE function using a VBA script across multiple rows.
- Observed behavior
- Excel throws a #CALC! error instead of rendering the images, which temporarily resolves only if a one-second delay is forced in the VBA loop.
Ensure your Excel version supports the IMAGE function (Microsoft 365) and verify that you have an active internet connection to allow Excel to download the images from the provided URLs.
Adjust VBA Timing and Calculation Sequence
Prevent #CALC! errors by separating the URL writing and formula evaluation processes in your VBA script, avoiding the need for a fixed one-second delay.
When VBA executes too rapidly, Excel may not have enough time to fetch the image from the network before the IMAGE formula evaluates, resulting in a #CALC! error. Adding a fixed wait time (like Application.Wait) for every row creates unnecessary performance bottlenecks.
Modify your VBA script to write all the target image URLs into a helper column as plain text strings, without applying the IMAGE formula yet.
Insert the 'Application.Calculate' command in your VBA script immediately after the URLs are written. This allows Excel's engine to process the newly added data before moving on.
In a separate loop or batch process within the same script, assign the '=IMAGE()' formula to your target cells, referencing the helper column where the URLs were placed.

Verify URL Accessibility and SSL Certificate
The IMAGE function requires properly secured HTTPS URLs that are accessible to the Excel application.
Try WPS Office for Smooth Spreadsheet Automation
If you frequently encounter calculation errors with complex VBA scripts and dynamic functions in Microsoft Excel, consider trying WPS Office. It provides a lightweight, highly compatible environment for managing your data and running automated tasks seamlessly.
- 1. Download and Install: Visit the official WPS Office website to download and install the free software suite.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheet and open your existing .xlsx or .xlsm file containing the data and macros.
- 3. Resume Your Work: Enjoy a smooth, highly compatible editing experience without worrying about heavy background processes.

Frequently Asked Questions
Why does the Excel IMAGE function return a #CALC! error?
This error typically occurs if the URL provided is invalid, the server returns an error, the URL lacks a trusted SSL certificate, or the formula is evaluated by VBA before the network request is fully completed.
Can the IMAGE function load pictures from local computer folders?
No, the IMAGE function in Microsoft Excel currently requires an HTTPS URL to fetch images from the internet. Using a local file path (like C:\Images\photo.jpg) will generally result in an error.
Is it bad practice to use Application.Wait in VBA to fix formula errors?
Yes. Adding a fixed wait time (such as one second per row) drastically slows down macro execution for large datasets. It is much more efficient to write the data, trigger a manual calculation event, and then apply the formulas.




