testing if there are named shapes on a sheet

J

juuljus.jogar

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
 
J

juuljus.jogar

(e-mail address removed) 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
 
B

Bob Phillips

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)
 

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