logo
search
VBA & Macro Problems

Fix Excel VBA Image Not Updating on Combo Box Change

Aamir Naveed AkramAamir Naveed Akram Sep 25, 2026 869 views

Question details

The user has an Excel VBA macro that loads a photo based on a combo box selection, but the image fails to refresh dynamically when a new option is chosen.

How to Fix Excel VBA Image Not Updating on Combo Box Change
Product
Microsoft Excel
Device & OS
not provided
Scenario
Using an ActiveX combo box to select different student profiles and load their corresponding photos from file paths stored in a worksheet.
Observed behavior
The macro loads the initial photo successfully into a shape but does not replace or update the image when a different student is selected from the combo box.
Before you start

Ensure your macro security settings allow VBA code to run and verify that the image file paths stored in your worksheet column are completely accurate and accessible.

Solution 1Recommended

Use the ComboBox Change Event and Clear Previous Shapes

Trigger the macro directly from the ActiveX combo box change event and ensure the previous image shape is deleted before inserting a new one.

When inserting pictures as shapes in VBA, Excel stacks them on top of one another unless you delete the old shape first. Tying this deletion and recreation process to the combo box's Change event ensures the visual updates in real-time.

1
Access the VBA Editor

Press Alt + F11 to open the VBA Editor, then double-click the sheet containing your ActiveX combo box in the Project Explorer.

2
Use the Change Event

Ensure your code is placed inside the 'Private Sub ComboBox1_Change()' event block so it triggers automatically upon making a new selection.

3
Delete Existing Images

Add a loop to locate and delete the existing image shape before inserting the new one. Loop through 'ActiveSheet.Shapes' and execute 'Shape.Delete' if the shape type is 'msoPicture' and matches the target area.

4
Insert the New Image

Use 'ActiveSheet.Pictures.Insert(imagePath)' to load the new student photo and set its Top and Left properties to position it correctly on the sheet.

Use the ComboBox Change Event and Clear Previous Shapes
Pro Tip: Name your image shape when you insert it (e.g., 'StudentPhoto'). This makes it much easier to target and delete specific shapes in your VBA loop without accidentally deleting other buttons or charts.
Seamless VBA Macro Support

Use WPS Spreadsheet for Robust VBA Macro Execution

WPS Office offers comprehensive support for Excel VBA macros, including ActiveX controls, user forms, and event-driven programming. You can run, edit, and debug your dynamic combo box image scripts natively within WPS Spreadsheet without worrying about compatibility issues.

  1. 1. Download and Install WPS Office: Download WPS Office from the official website and complete the quick installation process.
  2. 2. Open Your Macro-Enabled File: Launch WPS Spreadsheet and open your existing .xlsm file containing the VBA macros.
  3. 3. Enable Macros: Click 'Enable Macros' in the security prompt at the top of the screen to allow the ActiveX combo box to function.
  4. 4. Run and Debug: Test your combo box selections. You can press Alt + F11 to open the WPS VBA Editor to edit your image update code.
Fully compatible with Microsoft Excel VBA (.xlsm) macro formats.Lightweight installation with blazing-fast macro execution speed.Built-in VBA editor for seamless code debugging and testing.Free and highly capable alternative for dynamic data automation.
QA img-9

Frequently Asked Questions

Why is the LoadPicture function throwing an error in my VBA macro?

This usually happens if the file path provided in your worksheet column is incorrect, the image format is unsupported, or the image has been deleted from your local drive. Always verify that the path is absolute and accessible.

How do I ensure a macro triggers automatically when a combo box value changes?

You must use the Change event associated with that specific ActiveX control. Right-click the combo box while in Design Mode, select 'View Code', and place your macro execution commands inside the 'Private Sub ComboBox1_Change()' block.

Can WPS Office run Excel VBA macros that use ActiveX controls?

Yes, WPS Spreadsheet natively supports standard VBA macros and can seamlessly run scripts involving ActiveX controls like combo boxes and image controls, making it a highly compatible alternative to Microsoft Excel.