Using Excel picture annotation function to realize the interaction effect of mouse touch

Source: Internet
Author: User
Tags touch

Sometimes, in order to make a large and concise table, we need to add a hidden picture for the cells in the Excel table, and when the mouse points to the cell, it automatically shows the picture, moving away does not show, this mouse touch effect is not very cool?

To realize the interactive effect of the related picture when the mouse points to the cell in the Excel table, you can easily do it by adding a picture annotation feature in Excel 2007.

Below, we take the product list as an example to show the specific method of adding pictures.

mouse pointer to cell, automatically show preset picture

Single Add picture

Right-click the target cell, select Add annotation, delete all text in the annotation entry box, then move the mouse to the edge of the annotation input box, and when the pointer becomes a cross arrow, right-click to select "Format annotation" → "Color and line" → "fill effect" → "picture", and then click "Select Picture" to add a picture.

Now the mouse pointer to the target cell to display the picture, remove the mouse picture will be automatically hidden. If the picture does not automatically disappear when the mouse is moved, you can click Office in the upper-left corner of the Excel window, click Excel Options in the menu that pops up, select advanced on the left side of the Excel Options window, select Show only markers on the right, and highlight annotations on hover. The picture can be automatically hidden after the confirmation.

If you have many cells to add a picture annotation, setting it up is cumbersome. We can set up picture annotations by macro batch.

First of all need to use the picture file into a folder (for example: F:\ product map), each picture name must be the corresponding product name in the table, with "product name. jpg" such as the format named, such as Ang Tatsu vx545hd.jpg, Ang vx757.jpg and so on. In addition, all pictures should be in the same height ratio to ensure that the pictures displayed after the uniform settings are not distorted.

Then, open the workbook in Excel 2007, press the key combination "Alt+f8" to open the Macro window, enter the macro name "Add Picture annotation", click the Create button, and edit the code in the Open VBA window.

Code fragment:

Sub Add Picture annotation () 
   
 Dim cell on 
   
 Error Resume Next for each
   
 cell in Selection 
   
cell. AddComment 
   
Cell. Comment.Shape.Fill.UserPicture "F:\ product diagram \" & Cell. Value & ". jpg"
   
cell. Comment.Shape.Height = 
   
cell cell. Comment.Shape.Width = 
   
Next cell End 
   
Sub

Finally, close the VBA window and save the file as a document in the Excel macro-enabled Workbook format. Now you just select all the cells you want to set, such as A4:A20, press the key combination "Alt+f8" to open the Macro window, double-click "Add Picture Annotation" in the list to run the macro, you can add a picture of the cell in batches.

(Note: The picture is saved directly in the workbook after it is set up). If the product name in the table has changed, or the picture file used for the annotation has been replaced, you can just run the "Add Picture annotation" macro to refresh.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.