下面的代码删除当前工作表中的所有形状:
    Sub DeleteAllShapesInWorksheet()
    Dim shp As Shape
    For Each shp InActiveSheet.Shapes
    shp.Delete
    Next shp
    End Sub
    image.png
    下面的代码删除指定类型形状(图表和单元格批注)
    之外的所有形状:
    Sub 删除指定类型形状()
    Dim shp As Shape

    For Each shp InActiveSheet.Shapes
    If shp.Type <>msoChart And shp.Type <> msoComment Then
    shp.Delete
    End If
    Next shp
    End Sub