Deleting a shape through code

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Deleting a shape through code

Post by dasadler »

I have a bit of code and the next to last line says:

ActiveSheet.copyarchive.Delete

I have a shape named copyarchive that has a macro attached to it. When the shape is clicked, it copies and renames the worksheet. I would like to delete that shape from the copied worksheet but I continue to get an error. I have tried variations like these below but nothing has worked.

ActiveSheet.shape(copyarchive).Delete

ActiveSheet.shape("copyarchive").Delete

ActiveSheet.shape.copyarchive.Delete

ActiveSheet.shape"copyarchive".Delete
Don

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Deleting a shape through code

Post by dasadler »

I found my error. I used ActiveSheet.shapes("copyarchive").Delete and all is well.
Don