deleting pictures

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

somehow i used the drag tool and copied about 10000 pictures. is there a way
to delete them all without individually selecting the pictures? the pictures
are named from picture 118-17596. is there a way to use a loop function that
will delete these pictures? or select them like selecting multiple cells?

please help

thanks in advance
 
It sounds like you want to keep some of the pictures.

So if that's true and your pictures are named nicely (like you wrote), maybe a
little macro will do it:

Option Explicit
Sub testme()
Dim myShape As Shape
Dim myStr As String

For Each myShape In ActiveSheet.Shapes
myStr = LCase(myShape.Name)
If Left(myStr, 8) = "picture " Then
myStr = Application.Substitute(myStr, "picture", "")
If CLng(myStr) > 118 Then
myShape.Delete
End If
End If
Next myShape

End Sub

Save before you try it--then you can close without saving if it's not correct.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
Activesheet.Pictures.Delete

if you don't have any activeX controls on the sheet.
 

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

Back
Top