How to show image on mouseover in Excel?
Sometimes, you may wish to create a more interactive Excel worksheet by displaying an image only when a user hovers the mouse over a specific cell. For example, this can be particularly useful for providing visual references, instructions, or product images tied to data entries without cluttering your worksheet with always-visible graphics. This guide will introduce several methods to achieve the effect of showing an image as a pop-up or tooltip on mouseover in Excel, each with their own applicable scenarios and limitations. Depending on your needs—whether you require image display, text-only tooltips, or more advanced interactivity—different solutions may suit your workflow better.
Insert a pop-up picture by using comment
Use VBA to dynamically show pop-up images on mouseover
Display tooltips with Data Validation Input Message
Insert a pop-up picture by using comment
In Excel, a practical method for displaying an image only when hovering over a cell is by inserting the image into a comment (also known as a note in some newer Excel versions). This approach offers a straightforward way to create pop-up images that appear when the user points their mouse at the cell.
Common scenarios for this method include showing reference diagrams, product pictures, or explanatory images for data points. The main benefit of this technique is that it does not require the use of VBA or external add-ins, making it widely compatible and easy to manage. However, comments are not supported in Excel Online and may have limitations in terms of formatting and interactivity compared to more advanced solutions.
1. Select the cell where you want to have the pop-up image. Right-click the cell, then choose Insert Comment (or "New Note" depending on your version) from the context menu. See screenshot:
2. After the comment box appears, hover your pointer over the edge of the comment until it changes to a cross with arrows, right-click the border, and select Format Comment. See screenshot:
3. In the Format Comment dialog, click the Colors and Lines tab. Next, click the drop-down arrow under Color and choose Fill Effects from the list. See screenshot:
4. Switch to the Picture tab in the pop-up dialog. Click Select Picture, navigate to and select the image you'd like to display, then click Insert. See screenshots:
Note: In Excel2013 or later, after clicking the Select Picture button in the Fill Effects dialog, make sure to use the From a file option, select your image, and click Insert.
5. Confirm your changes by clicking OK in each dialog box to close them. Now, your image will appear inside the comment for the selected cell. See screenshot:
6. You may want to personalize the comment by deleting the default user name text. Click on the comment text and remove the name, leaving only the image.
Tip: To ensure the comment only shows on mouseover and doesn't always remain visible, make sure Show All Comments is not enabled on the Review tab.
This method is ideal for adding occasional images as pop-ups in small to medium-sized worksheets, but if you require advanced interactivity, dynamic image updates, or support for many images across a larger sheet, consider using VBA-based or interactive cell-linked methods described below.
Common issues include images not displaying if comments are hidden or if the comment box is too small for the image. Always check the image dimensions and comment box size for the best appearance.
Use VBA to dynamically show pop-up images on mouseover
For scenarios where you need more flexible control over how and when images appear—for example, displaying images as custom pop-up windows or rich tooltips when you mouse over specific cells—a VBA solution is recommended. This approach allows you to programmatically show and hide images, making it suitable for larger datasets, dashboards, or use cases where images change based on data.
This method is best if you need:
- Pop-up images of varying sizes or formats based on cells hovered
- Support for updating images dynamically with minimal worksheet clutter
- More control over display behavior compared to standard comment-based images
Potential drawbacks: VBA solutions are not supported in Excel Online or by users who do not enable macros, and may require more setup and basic VBA knowledge. Care should be taken when distributing such files due to macro security settings.
Operation Steps:
1. Open the worksheet on which you want to display the pop-up images, right click the worksheet tab, and then choose View Code from the context menu.
2. Copy and paste the following code into the worksheet code window (not a standard module):
Dim popUpPic As Picture
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Not popUpPic Is Nothing Then
popUpPic.Delete
End If
' Optional: Only run for a specific range, e.g. B2:B5
If Not Intersect(Target, Range("B2:B5")) Is Nothing Then
Set popUpPic = ActiveSheet.Pictures.Insert("C:\YourImagePath\yourimage.jpg")
With popUpPic
.Top = Target.Top
.Left = Target.Offset(0, 1).Left
.Height = 80 ' Adjust size as needed
.Width = 80
.Placement = xlMoveAndSize
End With
End If
End Sub
Note:
- Modify
Range("B2:B5")
to match the cells where you want pop-up images to appear. - Replace
"C:\YourImagePath\yourimage.jpg"
with your real image path. - If you want to use different images per cell, try the following VBA code.
Dim popUpPic As Picture 'Updated by Extendoffice.com 2025/7/11 Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error Resume Next If Not popUpPic Is Nothing Then popUpPic.Delete End If If Not Intersect(Target, Me.Range("B2:B5")) Is Nothing Then Dim imgPath As String Select Case Target.Address Case "$B$2" imgPath = "C:\Users\Win10x64Test\Desktop\fruits\durian.jpg" Case "$B$3" imgPath = "C:\Users\Win10x64Test\Desktop\fruits\Mango.jpg" Case "$B$4" imgPath = "C:\Users\Win10x64Test\Desktop\fruits\orange.jpg" Case "$B$5" imgPath = "C:\Users\Win10x64Test\Desktop\fruits\strawberry.jpg" Case Else imgPath = "" End Select If imgPath <> "" Then Set popUpPic = Me.Pictures.Insert(imgPath) With popUpPic .Top = Target.Top .Left = Target.Offset(0, 1).Left .Height = 80 .Width = 80 .Placement = xlMoveAndSize End With End If End If End Sub
- This code example displays the image whenever the user selects a cell in the range; similar logic can be adapted for
Worksheet_BeforeDoubleClick
orWorksheet_BeforeRightClick
for other trigger events.
3. Close the VBA editor and return to Excel. Select a cell within your specified range to display the pop-up image. Images will be hidden when another cell is selected.
If you encounter errors, ensure macro settings allow VBA code to run, and verify that the image path is correct. When distributing your file, remind users to enable macros for this feature to function.
Display tooltips with Data Validation Input Message
If you only need to show a text-based tooltip for additional information when a user hovers over a cell, you can use Excel's built-in Data Validation Input Message feature. While this method cannot display images, it offers a simple, no-code way to provide descriptions, instructions, or warnings as pop-ups. This is useful for forms, surveys, or educational templates where basic guidance or context is needed on mouseover.
How to set up:
- Select the cell or range where you want the tooltip.
- Go to Data tab > Data Validation.
- In the Data Validation dialog, go to the Input Message tab.
- Check Show input message when cell is selected. Enter a title and input message (up to255 characters).
- Click OK. Now, your custom tooltip will appear when the cell is selected or hovered.
Limitations: Input messages only show text (not images), and the message disappears when the cell is no longer selected. For graphic pop-ups, see the other methods above.
This method is widely compatible, requires no macros, and can be easily updated or removed as needed. If you need to provide concise text hints or reminders across many data entry cells, this is a practical and efficient solution.
Each approach has its strengths—comment images are easy to add for a few cells, VBA is best for dynamic or large batches, hyperlinks with helper macros allow for interactive image updates, while Data Validation Input Messages are ideal for text-based pop-ups. Carefully consider your worksheet users' needs and platform compatibility when choosing a solution. If you encounter common issues such as images not displaying, text not updating, or macro-related warnings, double-check cell ranges, macro permissions, and image file paths. For enhanced features or more automated workflows, additional Excel add-ins like Kutools for Excel can offer even more streamlined solutions.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!