ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting shapes (https://www.excelbanter.com/excel-programming/313625-deleting-shapes.html)

Dr.Schwartz

Deleting shapes
 
How can I programatically select and delete x number of shapes in a sheet?

I tried this with no luck:

ActiveSheet.Shapes.Select
Selection.Delete

Thanks
The Doctor

Loomah[_2_]

Deleting shapes
 
Doc
This could depend on how many you want to delete or if there are only
certain types of shape to delete

To delete all, try:-
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
shp.Delete
Next

To delete by name/type try this for AutoShapes only, assuming shapes haven't
been renamed:-
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.Name Like "AutoShape*" Then
shp.Delete
End If
Next

Happy Friday
;-)


Dr.Schwartz wrote in message
...
How can I programatically select and delete x number of shapes in a sheet?

I tried this with no luck:

ActiveSheet.Shapes.Select
Selection.Delete

Thanks
The Doctor





All times are GMT +1. The time now is 12:22 PM.

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