Is this "If Statement" Possible?

  • Thread starter Thread starter Pete
  • Start date Start date
P

Pete

I want an if statement like "=if(a1=1,"A","B")" instead of
inserting the A or B I want it to insert a picture file in
the cell. "=if(a1=1,Picture A,Picture B)" Is this
possible?

Thanks
Pete
 
Unfortunately, that is not possible. A formula can only change the
value in the cell. Also, images in XL are never *in* a cell. They
reside in a layer that 'floats' above the cells.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
What about with VBA? This is something that's intrigued me for a while,
and I've been waiting for a project where I might get to test it out.

Specifically, I was thinking in terms of a card game. Have an array of
52 cards, and 52 card pictures stored on the hard drive. Based upon
what random value was called, load a picture.

So, for example, if the array randomly selects DI,4 (4 of Diamonds)
then make the first picture DI4.jpg

Any way to have VBA code change / modify OLE objects? I know in access
I had a way to do it, where I stored 52 pictures as an OLE table. But
Excel doesnt work that way.

So, any light that can be shed on that, thanks. :)

-Bob
 
Turn on the macro recorder (Tools | Macro > Record new macro...),
insert an image from a file, delete the inserted image, and turn off
the recorder.

XL will give you the necessary starter code that you can then modify
and generalize.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
Back
Top