Excel 如何从包含图像的列中删除空白单元格?

Excel 如何从包含图像的列中删除空白单元格?,excel,image,Excel,Image,我有一张excel表格,其中一列有图像。我需要删除每一行不包含图像。所以,我需要从包含列的图像中获取所有单元格。请帮助以下是列A中图像的示例 Sub RowKiller() Dim s As Shape, rPic As Range, r As Range Dim wMAX As Long, i As Long Set rPic = Nothing For Each s In ActiveSheet.Shapes Set r = s.TopLef

我有一张excel表格,其中一列有图像。我需要删除每一行不包含图像。所以,我需要从包含列的图像中获取所有单元格。请帮助

以下是列A中图像的示例

Sub RowKiller()
    Dim s As Shape, rPic As Range, r As Range
    Dim wMAX As Long, i As Long
    Set rPic = Nothing

    For Each s In ActiveSheet.Shapes
        Set r = s.TopLeftCell
        If wMAX < r.Row Then
            wMAX = r.Row
        End If
        If rPic Is Nothing Then
            Set rPic = r
        Else
            Set rPic = Union(rPic, r)
        End If
    Next s

    For i = wMAX To 1 Step -1
        If Intersect(rPic, Cells(i, 1)) Is Nothing Then
            Cells(i, 1).EntireRow.Delete
        End If
    Next i
End Sub
Sub-RowKiller()
尺寸s为形状,rPic为范围,r为范围
Dim wMAX尽可能长,我尽可能长
设置rPic=Nothing
对于ActiveSheet.Shapes中的每个
设置r=s.TopLeftCell
如果wMAX
之前:

之后:


图像是完全封闭在单个单元格内还是重叠在多个单元格内?我已确保每个图像封闭在单独的单元格内,并且图像不会重叠或干扰其他图像