Probably, if you are programming with Excel as much as me, one day you have the following question – all the pictures in Excel are generated by my code and I really do not care to give them names. I simply want to delete them all. Concerning the fact that you do not name the generated pictures, it is a little difficult to do it, naming each picture.
Anyway this query has a solution in the following code:
For Each Shape In ActiveSheet.Shapes
If Left(Shape.Name, 7) = "Picture" Then
It is quite a clever way to delete the pictures, eh? With a little modification, this can actually delete any shape you would like to. Simply change “Picture” to the name of the shape and change the “7” in the code to the number of the letters.
So far so good!