Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display image in excel as formula result

Status
Not open for further replies.

golding100

Technical User
Joined
May 24, 2001
Messages
6
Location
GB
I need to display an image as the result of a formula in excel 97/2000. Something like
if(a1=>0,imageToDispay.gif,otherImage.gif)

I know the above will not work, any ideas how this can be done?
 
Why do you want to do this? What do the pictures stand for?

There might be another solution to this, because the only thing I can think of now is only possible in VBA.



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Can't be done from a formula
The only way it would work would be to use the worksheet calculate event and check the result of the cell to bring up an image

Rgds, Geoff
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?
Want the best answers to your questions ? faq222-2244
 
Thanks guys,
I have done some VBA stuff in the past, but i do not know how to use it to place an image in a cell, could you give me an example of what you mean.

As for why, the images are smilies linked to the profit and loss columns, I am sure you can guess the rest. BTW No its not my idea and yes I know I could do it with wingdings font but the boss says he wants gifs cos they look nicer.

Any help will be much appreciated guys, thanks.
 
Well lets say you have 2 pictures:
Pic1.gif
Pic2.gif

Insert them into the worksheet and NAME them Pic1.gif and Pic2.gif

The pseudoformula in cell A1 would be:
=if(test = true, "Pic1.gif","Pic2.gif")

Set the pictures up so that one is on top of the other
In the worksheet_calculate event

Private Sub Worksheet_Calculate()
For Each shp In ActiveSheet.Shapes
If shp.Name = Range("A1").Text Then
shp.Visible = True
Else
shp.Visible = False
End If
Next
End Sub

this should get you going


Rgds, Geoff
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?
Want the best answers to your questions ? faq222-2244
 
This was also the subject of an earlier thread, answered by Dale Watson, see this ...

thread68-494601

Cheers, Glenn.
 
Geoff,
Many thanks, thats got me on the right track.
Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top