0

I have an excel spreadsheet. I have 3 different pictures, in cells A1, B1, C1. Cell D1 has a value (one, two or three). Based on the value in D1, i need the cell E1 to display the picture in cell A1, A2 or A3

like this

if(d1="one"; display the picture in A1)
if(d1="two"; display the picture in B1)
if(d1="three"; display the picture in C

Any ideas how do I display the picture based on the IF function?

4
  • You cannot put pictures "in" a cell, only "over" it. All pictures "float" on the worksheet. You can position a picture over a cell by setting its Top and Left properties to the Top and Left of the cell. Commented May 7, 2013 at 16:31
  • is there any way i could actually use the left and top properties in a function? Commented May 7, 2013 at 16:42
  • What I was saying is you claim to have the pictures, in the cell, do you mean you have them Over the cells? Commented May 7, 2013 at 17:10
  • they're over the cell. i've seen something like that a while ago in another excel document, it worked pretty much like an HTML iframe. Whatever was in the frame was being shown somewhere else. But I can't really find it now, and I never really managed to figure out how it works Commented May 7, 2013 at 17:13

1 Answer 1

0
Select Case Range("D1")
Case one
    ActiveSheet.Shapes("Picture 1").Visible = True
    ActiveSheet.Shapes("Picture 2").Visible = False
    ActiveSheet.Shapes("Picture 3").Visible = False
Case two
    ActiveSheet.Shapes("Picture 1").Visible = False
    ActiveSheet.Shapes("Picture 2").Visible = True
    ActiveSheet.Shapes("Picture 3").Visible = False
Case three
    ActiveSheet.Shapes("Picture 1").Visible = False
    ActiveSheet.Shapes("Picture 2").Visible = False
    ActiveSheet.Shapes("Picture 3").Visible = True
End Select

Change the names of the picture to your picture names.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.