以下代码放到Sheet1中 Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Target.Address = "$A$1" Then Dim pth As String Dim pthname As String Dim rng1 As Range Dim rng2 As Range On Error Resume Next pth = ThisWorkbook.Path & "\" & "New Folder\" Application.ScreenUpdating = False With Sheet1 Set rng1 = .Cells(1, 1) If Len(rng1.Text) Then Set rng2 = .Cells(1, 3) .Pictures(rng2.Address(0, 0)).Delete pthname = Dir(pth & rng1.Text & "*") With ActiveSheet.Pictures.Insert(pth & pthname) .Name = rng2.Address(0, 0) .Height = rng2.Height .Top = rng2.Top .Left = rng2.Left .Width = rng2.Width End With End If End With Application.ScreenUpdating = True End If End Sub |