Clearing rectangles

  • Thread starter Thread starter Andrew B
  • Start date Start date
A

Andrew B

Hi

I have a number of rectangles that I want to delete from an area on a
worksheet. What is the quickest way to do this ?

I have tried the following but it didn't quite work ...

Sub rem1()
Set Shr = Sheets("Reports")


For Each Rectangle In Shr.Range("B26:V53") ' graph area
Rectangle.Delete
Next

End Sub


Thanks in advance

Andrew B
 
Can you just look at the topleftcell of the shape?

option explicit
sub rem2()
dim myRect as Rectangle
dim myRng as range

set myrng=worksheets("Reports").range("B26:v53")

for each myrect in myrng.parent.rectangles
if intersect(myrect.topleftcell, myrng) is nothing then
'not in that area
else
myrect.delete
end if
end sub

(Untested--so watch out for typos!)
 

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

Back
Top