Delete all drawings/shapes except DownArrows

P

Pete

Hi all

I have written a subroutine to delete all shapes on a sheet but not any
DownArrows

Sub DeleteShapesExceptDownArrows()
Dim MyShape As Object
For Each MyShape In ActiveSheet.Shapes
If MyShape.Name <> msoShapeDownArrow Then
MyShape.Delete
End If
Next MyShape
End Sub

However, the routine deletes all shapes regardless!

Any ideas?

--
Regards,
Peter Bircher

AutomateXcel
http://www.automatexcel.co.za/index.html

Cell : 083 233 1628
Email: (e-mail address removed)
 
D

Dave Peterson

The .name property isn't what you want to you. The Name is the string you see
in the namebox (to the left of the formulabar).

I'd try:

Option Explicit
Sub DeleteShapesExceptDownArrows()
Dim MyShape As Shape
For Each MyShape In ActiveSheet.Shapes
If MyShape.AutoShapeType <> msoShapeDownArrow Then
MyShape.Delete
End If
Next MyShape
End Sub
 
P

Pete

Thank you so much, Dave.

Been battling with it all day . . . :)

Regards,
Peter Bircher

Cell : 083 233 1628
Email: (e-mail address removed)
 

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

Top