ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete grouped shapes? (https://www.excelbanter.com/excel-programming/357541-delete-grouped-shapes.html)

Dr.Ile[_13_]

Delete grouped shapes?
 

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


--
Dr.Ile
------------------------------------------------------------------------
Dr.Ile's Profile: http://www.excelforum.com/member.php...o&userid=15975
View this thread: http://www.excelforum.com/showthread...hreadid=527961


Norman Jones

Delete grouped shapes?
 
Hi Dr. Ile,

Your question appears ambiguous.

However, try changing:

For Each SHP In ActiveSheet.Shape


to

For Each SHP In ActiveSheet.Shapes


---
Regards,
Norman



"Dr.Ile" wrote in
message ...

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


--
Dr.Ile
------------------------------------------------------------------------
Dr.Ile's Profile:
http://www.excelforum.com/member.php...o&userid=15975
View this thread: http://www.excelforum.com/showthread...hreadid=527961




NickHK

Delete grouped shapes?
 
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

"Dr.Ile" wrote in
message ...

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


--
Dr.Ile
------------------------------------------------------------------------
Dr.Ile's Profile:

http://www.excelforum.com/member.php...o&userid=15975
View this thread: http://www.excelforum.com/showthread...hreadid=527961





All times are GMT +1. The time now is 05:48 PM.

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