【发布时间】:2015-07-21 10:51:45
【问题描述】:
我正在尝试在 Excel 工作表中显示链接到单元格值的图像
示例 - 如果单元格 A1 = 值 10,则显示图像(图片 10)
然后是另一个单元格
如果 Cell Cell A10 - 值为 90%,则显示图像(图片 90)。
我使用了下面的 VBA 代码,它对 A1 工作正常,但是当我添加第二个单元格值和图片时,它只会显示 A1 值/图片。
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("J27")) Is Nothing _
And Not Target.Count > 1 Then
For Each shp In Me.Shapes
If shp.Type = msoPicture Then
shp.Visible = msoFalse
End If
Next
Select Case Range("J27").value
Case "10"
Me.Shapes("Picture 10").Visible = msoTrue
Case "11"
Me.Shapes("Picture 11").Visible = msoTrue
Case "12"
Me.Shapes("Picture 12").Visible = msoTrue
Case "13"
Me.Shapes("Picture 13").Visible = msoTrue
Case "14"
Me.Shapes("Picture 14").Visible = msoTrue
End Select
End If
End Sub
请帮忙!
【问题讨论】:
-
请更正您的代码格式,这样更容易发现问题