View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default deleting pictures

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

choice wrote:

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


--

Dave Peterson