本文转载自公众号:VBA小技能。
根据选择的单元格,自动跳出匹配图片
-----------代码分割线-------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.Pictures.Delete
Set Target = Selection
If Target <> '' Then
ActiveSheet.Pictures.Insert(ThisWorkbook.Path & '\' & Target.Value & '.jpg').Select
With Selection.ShapeRange
.Width = 100
.Height = 100
.Left = Target.Left 55
.Top = Target.Top
End With
End If
Set Target = Nothing
End Sub
----------代码结束线---------
联系客服