Delete All Picture Objects Using VBA

N

Nathan Bell

All,

I am looking for some code that will allow me to go in and delete all
"Picture" objects from within a worksheet without deleting the rest of the
data. Is this possible?

Regards,

Nathan
 
D

Don Guillett

various ways

Sub ShapesCut()
For Each S In ActiveSheet.Shapes
S.Cut
Next
End Sub
'or

Sub shapescut1() 'Tom Ogilvy
ActiveSheet.Shapes.SelectAll
Selection.Delete
End Sub

Sub ShapesALLinWorkbookDelete() 'Deletes all in WORKBOOK
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
sh.DrawingObjects.Delete
Next sh
end sub
 
B

Bernie Deitrick

Nathan,

ActiveSheet.DrawingObjects.Delete

Or simply use Edit | Go To... Objects, press OK, then Delete.

HTH,
Bernie
MS Excel MVP
 
D

Debra Dalgleish

If you want to delete only Pictures, but not other shapes, such as text
boxes, you can use code similar to the following:

'======================
Sub DeletePictures()
Dim shp As Shape
For Each shp In ActiveSheet.ShapeRange
If shp.Type = msoPicture Then
shp.Delete
End If
Next shp
End Sub
'=====================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top