删除行&;来自Excel的图像
我需要删除列和Excel中的所有图像在一次点击。我有一个宏,允许我删除图像,但它不删除列删除行&;来自Excel的图像,excel,excel-formula,excel-2010,vba,Excel,Excel Formula,Excel 2010,Vba,我需要删除列和Excel中的所有图像在一次点击。我有一个宏,允许我删除图像,但它不删除列 Sub RemoveDrawingObjects() 'Removes any drawing / chart / shapes / ocx control objects from the active worksheet. Dim iCount As Integer Dim Embedded_Objects As Integer Embedded_Objects = ActiveSheet.Sh
Sub RemoveDrawingObjects()
'Removes any drawing / chart / shapes / ocx control objects from the active worksheet.
Dim iCount As Integer
Dim Embedded_Objects As Integer
Embedded_Objects = ActiveSheet.Shapes.Count
For iCount = Embedded_Objects To 1 Step -1
ActiveSheet.Shapes(iCount).Delete
Next iCount
End Sub
这是我用来删除图像的代码,效果很好,我如何让它删除突出显示的列
欢迎提供任何建议或提示
我的建议是删除图像,然后只删除列,但他们希望一次单击即可全部删除。如果已选择列,则:
Sub RemoveDrawingObjects()
'Removes any drawing / chart / shapes / ocx control objects from the active worksheet.
Dim iCount As Integer
Dim Embedded_Objects As Integer
Embedded_Objects = ActiveSheet.Shapes.Count
For iCount = Embedded_Objects To 1 Step -1
ActiveSheet.Shapes(iCount).Delete
Next iCount
'delete active column
ActiveCell.EntireColumn.Delete
End Sub
此外,删除所有形状的更简单方法是:
Sub RemoveDrawingObjects()
'Removes any drawing / chart / shapes / ocx control objects from the active worksheet.
Dim shp_fordelete As Shape
For Each shp_fordelete In ActiveSheet.Shapes
shp_fordelete.Delete
Next shp_fordelete
'delete active column
ActiveCell.EntireColumn.Delete
End Sub