Most Valuable Professional


View Jan Karel Pieterse's profile on LinkedIn subscribe to rss feed
Subscribe in a reader

Home > English site > Articles > Show Picture
Deze pagina in het Nederlands

Showing a picture from a list of pictures

Introduction

Many people keep part lists in Excel. Sometimes even with embedded pictures next to the part data.

This article demonstrates a method to show a picture on a sheet that changes when a different part number is chosen from the list of available part numbers.

Preparing the list

The first thing to do is to position the pictures properly. Each picture should go in a cell on the same row as a unique description (part number) of the part it pertains to.

Format the cells, so the picture fits in a single cell (either adjust the size of the picture, or adjust row height and column width):

Figure 1, screenshot showing a list of icons next to their description

Preparing the sheet that shows the dynamic picture

We need some way of knowing which picture is to be shown. We start off by defining a dynamic range name that will expand automatically when we add new items to our list (assuming they are on Sheet1, starting on cell A1, with one row of headings) Choose Insert, name define (In Excel 2007 on the "Formulas" tab of the ribbon, in the "Defined Names" group, click the "Define Name" button) and define this name:

Name Refers to
PictureList =OFFSET(Sheet1!$A$1,1,0,COUNTA(Sheet1!$A:$A)-1,1)

Let us say cell A2 on sheet2 will be used to enter the picture code we want to see the picture from. The formula in the next defined name will point to the cell to the right of the cell who's picture name matches the text entered in cell Sheet2!A2:

Name Refers to
Picture =OFFSET(Sheet1!$B$2,MATCH(Sheet2!$A$2,PictureList,0)-1,0,1,1)

Creating the picture

Excel 2007

There are two methods to insert the proper picture in Excel 2007. One is by adding the camera tool to your QAT and using that, the other is shown below.

Select the cell where you want your dynamic picture to appear and click the Insert tab of the ribbon.  On the far right, find the "Object" button and click it (see screenshot below).


Figure 2, Insert Object button on the ribbon

The Insert object dialog appears:


Figure 3, Object Dialog

Select the top option (Bitmap Image) and click OK. Hit escape to return to Excel. The newly inserted picture object should still be selected. The formula bar should show something like =EMBED("Paint.Picture";""). Click in the formula bar and replace the entire formula with this formula: =Picture


Figure 4, screenshot showing the picture's formula bar.

Hit enter or click the green checkmark to the left of the formula bar.

Excel 97 to 2003

Select the cell with the topmost picture. Hold down the shift key and click the Edit menu. It should show "Copy Picture...":

Figure 4, screenshot showing part of Excel's Edit menu when clicked whilst holding down the shift key.

Select "As shown on screen" from the next dialog and click OK.

Now navigate to the cell (on Sheet2 in this example) where you want to show the dynamic picture and hit the paste button (or control-v):

Figure 5, screenshot showing the pasted picture.

Figure 6, screenshot showing the pasted picture's formula bar.

Making the picture dynamic

To simplify the selection of the picture description, we can use Data, validation:

Now you can select from the available picture descriptions:

And we're done!

Download

Click here to download a sample file.

Other solutions

Bernie Deitrick came up with this nice sheet, which handles more pictures, but uses VBA


Comments

Showing last 8 comments of 112 in total (Show All Comments):

 


Comment by: Jan Karel Pieterse (12/11/2011 11:11:20 PM)

Hi Andy,

How can I be of help? In principle, this page describes all the steps needed to get exactly what you ask for...

 


Comment by: Andy (12/12/2011 6:20:23 AM)

Thanks much, Jan - I may be lacking some fundamental knowledge needed to make the small leap from this page's instructions to what I'm trying to do. I just can't figure out how to get offset, match, index and vlookup to work together in the right way to accomplish an image changing based on the selection from the drop-down list (the drop-down list is populated from a changing list on a second sheet; essentially, I have it looking at several hundred rows even though there are only a few dozen people at this time).

 


Comment by: Jan Karel Pieterse (12/12/2011 6:33:56 AM)

Hi Andy,

If you like you can send me the file and I'll have a look.

Just make sure you tell me where to look for the pictures and where the dropdown is that selects a name of which the pic is to be shown, so I don't have to work my way through your file and try to figure that out.

 


Comment by: Andy (12/12/2011 1:16:00 PM)

Thanks again - what's the best way to get it to you?

 


Comment by: Jan Karel Pieterse (12/13/2011 2:02:33 AM)

Hi Andy,

You can send it by email, address at the bottom of this page.

 


Comment by: lim ck (1/2/2012 10:02:43 AM)

Can the be use on live picture instead? meaning, the worksheet camera tool able to give command to download the photo i took directly?

Many thanks
lim

 


Comment by: Jan Karel Pieterse (1/2/2012 10:15:38 PM)

Hi Lim,

No, this example requires the picture to be placed on the worksheet.

 


Comment by: Yuda (1/15/2012 1:43:04 AM)

Thanks very much... (^_^)

 


Have a question, comment or suggestion? Then please use this form.

If your question is not directly related to this web page, but rather a more general "How do I do this" Excel question, then I advise you to ask your question here: www.eileenslounge.com.

Please enter your name (required):

Your e-mail address (optional but if you want me to respond it helps!; will not be shown, nor be used to send you unsolicited information):

Your request or comment:

To post VBA code in your comment, use [VB] tags, like this: [VB]Code goes here[/VB].