本帖最后由 苏子龙 于 2016-9-23 11:51 编辑
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rg As Range, picPth As String
Dim shp As Object
With Target
If .Count > 1 Then Exit Sub
If .Address <> "$AI$3" Then Exit Sub
End With
On Error GoTo er
Set rg = Range("x4").MergeArea
picPth = ThisWorkbook.Path & "\" & Range("e4") & ".jpg"
For Each shp In ActiveSheet.Shapes
If shp.Top = rg.Top Or shp.Left = rg.Left Then shp.Delete
Next shp
ActiveSheet.Shapes.AddPicture picPth, True, True, _
rg.Left, rg.Top, rg.Width, rg.Height
Exit Sub
er:
MsgBox "没找到图片或者名称不对", , "提示"
End Sub
改了下