Excel:根据表达式显示图片

时间:2013-05-07 16:22:25

标签: excel ms-office image

我有一个Excel电子表格。我在单元格A1,B1,C1中有3张不同的图片。 单元格D1具有值(一,二或三)。根据D1中的值,我需要单元格E1在单元格A1,A2或A3中显示图片

像这样

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

任何想法如何根据IF功能显示图片?

1 个答案:

答案 0 :(得分: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

将图片名称更改为图片名称。