View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Melanie Breden Melanie Breden is offline
external usenet poster
 
Posts: 88
Default how to delete all msoFreeForms on a chart

Hi Brian,

Brian Murphy wrote:
I have a chart sheet that contains a bunch of msoFreeForm objects, and I want to delete all of them hopefully with one statement.

If I select one and check its Typename I get "Rectangle". But Activechart.Rectangles.Delete does not delete them.

How can I delete them?


try this:
Dim sh As Shape

For Each sh In ActiveSheet.Shapes
If sh.Type = msoFreeform Then sh.Delete
Next sh

or delete all DrawingObjects:

ActiveSheet.DrawingObjects.Delete

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)