PDA

View Full Version : Solved: How to delete A LOT of autoshapes



milt8
11-03-2005, 02:58 PM
I have a worksheet with a lot of diamond-shaped autoshapes all over it. There are so many that deleting them manually one-at-a-time would take a long time. I would like to do a macro that will get rid of all of them. I tried:

worksheets(8).Shapes(msoShapesDiamond).Select
Selection.delete

But that did not work. One problem is I can't figure out how to name or identify these shapes. They came from the Autoshapes, Basic Shapes toolbar. I' m only guessing at "msoShapesDiamond."

Any help would be appreciated. Thanks.

milt8

austenr
11-03-2005, 03:34 PM
Try this:

Sub DeleteShapes()

For Each Sh In ActiveSheet.Shapes
Sh.Delete
Next Sh
End Sub

benny
11-03-2005, 03:37 PM
Try This

Sub Pic_Away()
Dim n As Integer
For n = 2 To Sheets.Count
Worksheets(n).Select
Worksheets(n).Shapes.SelectAll
Selection.Delete
Next n
End Sub

milt8
11-03-2005, 07:30 PM
Thanks you for the replies to my post. There are some autoshapes on the worksheet, e.g., ovals and rectangles, that I do not want to delete. I just want to delete the diamonds. Is there a way to do this?

If not, I'll try the suggestions for deleting all shapes and then put back the ones I want.

Thanks.

milt8

milt8
11-03-2005, 07:44 PM
It would also work for me if the deletions of all shapes could be restricted to the range B11:BC143. But I can't seem to do this. Any help will be appreciated.

milt8

johnske
11-03-2005, 09:40 PM
There are some autoshapes on the worksheet, e.g., ovals and rectangles, that I do not want to delete. I just want to delete the diamonds. Is there a way to do this?Sub DeleteDiamondShapes()'for the whole sheet
Dim Shp As Shape
For Each Shp In ActiveSheet.Shapes
If Shp.AutoShapeType = msoShapeDiamond Then
Shp.Delete
End If
Next
End Sub

milt8
11-04-2005, 08:20 AM
THANK YOU! This is exactly what I needed.

milt8