ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   deleting pictures (https://www.excelbanter.com/excel-programming/314982-deleting-pictures.html)

choice[_2_]

deleting pictures
 
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[_3_]

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


Tom Ogilvy

deleting pictures
 
Activesheet.Pictures.Delete

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

--
Regards,
Tom Ogilvy

"choice" wrote in message
...
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





All times are GMT +1. The time now is 12:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com