ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   testing if there are named shapes on a sheet (https://www.excelbanter.com/excel-programming/380747-testing-if-there-named-shapes-sheet.html)

[email protected]

testing if there are named shapes on a sheet
 
Hi,

I need to test if there are 3 named shapes (box1, box2 and box3) on the
worksheet or not. If they are present, delete them and if not then do
nothing.


Thanks,
Juuljus


[email protected]

testing if there are named shapes on a sheet
 

kirjutas:
Hi,

I need to test if there are 3 named shapes (box1, box2 and box3) on the
worksheet or not. If they are present, delete them and if not then do
nothing.


Thanks,
Juuljus


Got it working:

On Error Resume Next
ActiveSheet.Shapes("box1").Delete
ActiveSheet.Shapes("box2").Delete
ActiveSheet.Shapes("box3").Delete
On Error GoTo 0

If someone has other ideas, still I would be interested.

J


Bob Phillips

testing if there are named shapes on a sheet
 
For Each shp In ACtivesheet.Shapes
If shp.Name = "Box1" Or shp.Name = "Box2" Or shp.Name = "Box3" Then
shp.Delete
End If
Next shp

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


wrote in message
ups.com...
Hi,

I need to test if there are 3 named shapes (box1, box2 and box3) on the
worksheet or not. If they are present, delete them and if not then do
nothing.


Thanks,
Juuljus





All times are GMT +1. The time now is 12:53 AM.

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