Delete grouped shapes?

D

Dr.Ile

Hello

I’m trying to delete grouped shapes objects with name “Group 8”. On the
sheet are also other shape object (not grouped) which I won’t to delete.
The code which I write won’t work. I thing that something is wrong the
name, but I don’t know what. Can you help me.

Sub Delete_shapes()
Dim SHP As Shape
For Each SHP In ActiveSheet.Shape
If Not SHP.Name = "Group 8" Then
SHP.Delete
End If
Next SHP
End Sub

Than you

Drile
 
N

NickHK

Dr.Ile,
From your code it looks like you are trying to delete all shapes except
"Group 8".
Anyway, For Each.. requires a collection, so it is "ShapeS", not "Shape".
You would found an error on this line when you tried to run it.

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top