本文轉(zhuǎn)載自公眾號(hào):VBA小技能。
根據(jù)選擇的單元格,自動(dòng)跳出匹配圖片
-----------代碼分割線-------------
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
----------代碼結(jié)束線---------
聯(lián)系客服