我想从我的Excel电子表格中删除一些图片,但它们是相当多的,有些我需要保留...是否有一种快速的方式来保留我想要的图片并删除我不想要的图片?
答案 0 :(得分:1)
您需要告诉Excel哪些图片保持,因此在 A 列中,列出您要保留的图片的名称。然后运行这个小宏:
Sub PicturePerfect()
Dim s As Shape, N As Long, i As Long
Dim Keep As Boolean
N = Cells(Rows.Count, "A").End(xlUp).Row
Keep = False
For Each s In ActiveSheet.Shapes
sn = s.Name
Keep = False
For i = 1 To N
If sn = Cells(i, "A").Value Then
Keep = True
Exit For
End If
Next i
If Not Keep Then
s.Delete
End If
Next s
End Sub