DELETING OBJECTS FROM A WORKSHEET


Posted by Jiminey Dehey on October 30, 2001 7:23 AM

I need a macro that will delete all checkboxes, buttons and other objects from a worksheet all at once. Can anyone help?

Jim

Posted by Barrie Davidson on October 30, 2001 8:34 AM

Jim, how about this?

Sub DeleteShapes()
' Macro written by Barrie Davidson
Dim i As Integer
Dim counter As Integer
i = ActiveSheet.Shapes.Count
counter = 1
Do Until i = 0
ActiveSheet.Shapes(counter).Delete
i = ActiveSheet.Shapes.Count
Loop
End Sub

Regards,
BarrieBarrie Davidson

Posted by Juan Pablo on October 30, 2001 8:38 AM

How about...

Sub DelShapes()
ActiveSheet.Shapes.SelectAll
Selection.Delete
End Sub

Juan Pablo

Posted by Barrie Davidson on October 30, 2001 9:34 AM

Way better Juan.....

One of these days I'll beat you to the answer and my answer will be the most efficient (I'm on your tail now!!).

ha, ha

Barrie
:)



Posted by Ivan F Moala on October 30, 2001 6:11 PM

Re: How about...

This is OK....BUT just be carefull that the sheet
doesn't have comments......you will either delete
these (OK if required) or generate an error.


Ivan Sub DelShapes()