How To Delete More Than One Graphic From A Worksheet

  • Thread starter Robert P. Stearns
  • Start date
R

Robert P. Stearns

Is there a way to delete more than one graphic at a time from a worksheet?
Picking one at a time is a pain if you have lots to delete.
 
K

Kevin H. Stecyk

Robert P. Stearns...
Is there a way to delete more than one graphic at a time from a worksheet?
Picking one at a time is a pain if you have lots to delete.

Robert,

If they are shapes, then you can use the following:

Sub DeleteShapes()

Dim myShape As Shape

For Each myShape In ActiveSheet.Shapes
myShape.Delete
Next

End Sub


If it doesn't work, find out what the graphic is, and then just modify the
code to suit. Or come here and tell us what the "graphic" is, and we will
modify the code for you. One way to find out what the graphic is, is to
simply Tools | Macro | Record New Macro and then manually delete one
graphic. Look at the code generated. It will tell you what it deleted.

Hope that helps.

Regards,
Kevin
 
R

Robert P. Stearns

The graphics are jpg files that where copied and pasted into excel. I tried
recording a macro but nothing was recorded. In trying to record the macro, I
selected the graphic and clicked the delete button. Do you have any more
suggestions?
 
P

Peo Sjoblom

Did you try the macro Kevin provided, it should delete them if they are
inserted pictures. Another way would be to press F5, select special,
select objects and click OK

--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)
 
D

Dave Peterson

Then hit the delete key <vbg>.

Peo said:
Did you try the macro Kevin provided, it should delete them if they are
inserted pictures. Another way would be to press F5, select special,
select objects and click OK

--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)
 
Top