ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting Auto_Shapes (https://www.excelbanter.com/excel-programming/438978-deleting-auto_shapes.html)

John[_22_]

Deleting Auto_Shapes
 
Hi Everyone
I created a staircase calculator using AutoShapes (Triangles).
I need a macro to erase them.I can't use "Select All" because
it will erase my macro buttons.They are numbered but that changes
every time I use it.
Could I use something like Range "B3:P11 delete Shapes".
I need Help please.
Regards
John

Don Guillett[_2_]

Deleting Auto_Shapes
 
After testing. Just change last 2 comment lines in last macro

Sub AddShapeTriangle()
ActiveSheet.Shapes.AddShape(msoShapeIsoscelesTrian gle, _
213.96, 115.47, 18.34, 29.89).Select
End Sub

Sub DeleteShapeIfTriangle()
For Each sh In ActiveSheet.Shapes
'MsgBox sh.Name
'MsgBox sh.AutoShapeType
If sh.AutoShapeType = 7 Then MsgBox sh.Name
'If sh.AutoShapeType = 7 Then sh.Delete 'MsgBox sh.Name

Next sh
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"John" wrote in message
...
Hi Everyone
I created a staircase calculator using AutoShapes (Triangles).
I need a macro to erase them.I can't use "Select All" because
it will erase my macro buttons.They are numbered but that changes every
time I use it.
Could I use something like Range "B3:P11 delete Shapes".
I need Help please.
Regards
John



John[_22_]

Deleting Auto_Shapes
 
Hi Don
It works perfectly.Thank you again
Best Regards
John
"Don Guillett" wrote in message
...
After testing. Just change last 2 comment lines in last macro

Sub AddShapeTriangle()
ActiveSheet.Shapes.AddShape(msoShapeIsoscelesTrian gle, _
213.96, 115.47, 18.34, 29.89).Select
End Sub

Sub DeleteShapeIfTriangle()
For Each sh In ActiveSheet.Shapes
'MsgBox sh.Name
'MsgBox sh.AutoShapeType
If sh.AutoShapeType = 7 Then MsgBox sh.Name
'If sh.AutoShapeType = 7 Then sh.Delete 'MsgBox sh.Name

Next sh
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"John" wrote in message
...
Hi Everyone
I created a staircase calculator using AutoShapes (Triangles).
I need a macro to erase them.I can't use "Select All" because
it will erase my macro buttons.They are numbered but that changes every time
I use it.
Could I use something like Range "B3:P11 delete Shapes".
I need Help please.
Regards
John





All times are GMT +1. The time now is 10:55 AM.

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