Conditional Pictures

N

needsomehelp

How can I change a picture that is displayed in excel depending on
confition?? I.e. if a cell value is one I want to display a picture o
an apple next to it - if it is 2 I want to display a picture of a
orange next to it (simplified example obviously!!). I know that I ca
do this with a macro - but I want the picture to change automaticall
as the cell value changes without having to start a macro.

Any help would be appreciated!! Thank
 
N

Nick Hodge

You will need to do this with a macro, but you could place this is the
worksheet_change() event module which fires the code each time a cell is
changed on the worksheet

Look up worksheet events in VBA help

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
(e-mail address removed)


"needsomehelp" <[email protected]>
wrote in message
news:[email protected]...
 
D

damorrison

how about this:
If Selection.Value=1
'your code
elseif Selection.value = 2
'code here
end if
you can do some customizing, such as a worksheet change event
and then you would have to target that address so it only works in a
certain range if you need help with that one let us know
dave
 
R

Ron Coderre

For a non-VBA solution:

I'll assume you want to store the pictures on Sheet2 and show them o
Sheet1.

1)Set the fill color for every cell on Sheet2 to White, then:
For each picture to be displayed:
1a. Insert>Picture from file. (select your picture and put it in th
sheet).
1b. Select the range of cells that contains the picture and name it s
it includes the text that the dropdown will display:
Example:
If an item in the list will be "Camel" and the selection is a pictur
is of a Camel:
Insert>Name>Define
Name: picCamel

2)Build your data validation list on a cell in Sheet1 and pick one o
the items.

3)Create a dynamic range name that refers to that cell:
Insert>Name>Define
Name: ShowMyPic
RefersTo: =INDIRECT("pic"&Sheet1!$A$1)
...or whatever cell you chose.

4)Copy/Paste any one of the pictures from Sheet2 into the cell o
Sheet1 where you want pictures to display.

5)While the picture is still selected, type this in the formula bar
then press [Enter]:
=ShowMyPic

The picture will be replaced by the picture referred to by the dropdow
list.

Each time you select a different item in the list, the associate
picture will appear in the picture box and resize appropriately.

Is that something you can work with?

Regards,
Ro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top