View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Clearing rectangles

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!)

Andrew B wrote:

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


--

Dave Peterson