Enlarge an Excel Picture When Clicked With VBA
Question details
The user wants an Excel picture to enlarge when clicked and return to its original size after a short delay.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains pictures that the user wants to preview at a larger size without permanently resizing them.
- Observed behavior
- The desired behavior is for a clicked picture to temporarily double in size and then return to its original dimensions.
Open the workbook in desktop Excel and confirm that the pictures are individual worksheet shapes. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm), and enable macros only if you trust the file.
Assign a VBA macro to each Excel picture
Use one macro to temporarily double the dimensions of any picture assigned to it.
Excel does not provide a simple mouse-over event for worksheet pictures. This click-based workaround identifies the clicked picture through Application.Caller, stores its dimensions, and restores them after a two-second delay.
In desktop Excel, open the Developer tab and select Visual Basic. In the VBA editor, select Insert > Module.
Paste the following code into the module: Sub EnlargePicture() Dim pic As Shape Dim originalWidth As Double Dim originalHeight As Double Set pic = ActiveSheet.Shapes(Application.Caller) originalWidth = pic.Width originalHeight = pic.Height pic.Width = originalWidth * 2 pic.Height = originalHeight * 2 Application.Wait Now + TimeValue("00:00:02") pic.Width = originalWidth pic.Height = originalHeight End Sub
Return to the worksheet, right-click a picture, select Assign Macro, choose EnlargePicture, and select OK. Repeat for each picture you want to enlarge.
Save the .xlsm workbook, then click an assigned picture on the worksheet. It should double in size, pause for about two seconds, and return to its original dimensions.

Work with spreadsheet pictures in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Excel-format spreadsheets. Its format compatibility helps you move existing files into WPS, though this Excel-specific VBA workaround may not run in every WPS installation.

Frequently Asked Questions
Can an Excel picture enlarge when I hover over it?
Excel does not provide a simple mouse-over event for worksheet pictures. Assigning a VBA macro through the picture's right-click menu provides a click-based alternative.
How do I change the enlargement time or size?
In Developer > Visual Basic, edit the macro's TimeValue("00:00:02") to change the delay. Change both multiplication factors from 2 to another value to adjust the enlargement.
Why doesn't clicking the picture run the macro?
Right-click the picture and check Assign Macro to confirm that EnlargePicture is selected. Also check whether Excel has disabled macros and enable them only if you trust the workbook.
Can I use the same macro for multiple pictures?
Yes. Right-click each picture, select Assign Macro, and choose EnlargePicture. Application.Caller identifies the picture that was clicked.
Can I run this VBA macro in Excel for the web?
No. Excel for the web cannot run VBA macros. Open the workbook in desktop Excel to assign and run the macro.




