ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Conditional Pictures (https://www.excelbanter.com/excel-discussion-misc-queries/55141-conditional-pictures.html)

needsomehelp

Conditional Pictures
 

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

Any help would be appreciated!! Thanks


--
needsomehelp
------------------------------------------------------------------------
needsomehelp's Profile: http://www.excelforum.com/member.php...o&userid=28761
View this thread: http://www.excelforum.com/showthread...hreadid=484504


Nick Hodge

Conditional Pictures
 
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
HIS


"needsomehelp"
wrote in message
...

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

Any help would be appreciated!! Thanks


--
needsomehelp
------------------------------------------------------------------------
needsomehelp's Profile:
http://www.excelforum.com/member.php...o&userid=28761
View this thread: http://www.excelforum.com/showthread...hreadid=484504




damorrison

Conditional Pictures
 
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


Ron Coderre

Conditional Pictures
 

For a non-VBA solution:

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

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

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

3)Create a dynamic range name that refers to that cell:
InsertNameDefine
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 on
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 dropdown
list.

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

Is that something you can work with?

Regards,
Ron


--
Ron Coderre
------------------------------------------------------------------------
Ron Coderre's Profile: http://www.excelforum.com/member.php...o&userid=21419
View this thread: http://www.excelforum.com/showthread...hreadid=484504


Dave Peterson

Conditional Pictures
 
One mo

You may want to look at J.E. McGimpsey's routine:
http://www.mcgimpsey.com/excel/lookuppics.html



needsomehelp wrote:

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

Any help would be appreciated!! Thanks

--
needsomehelp
------------------------------------------------------------------------
needsomehelp's Profile: http://www.excelforum.com/member.php...o&userid=28761
View this thread: http://www.excelforum.com/showthread...hreadid=484504


--

Dave Peterson


All times are GMT +1. The time now is 11:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com