Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Clearing rectangles

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Clearing #N/A's in one go? Lee Harris Excel Worksheet Functions 5 November 22nd 05 06:52 PM
Clearing #VALUE skateblade Excel Worksheet Functions 3 October 15th 05 10:34 PM
How to insert small colored dots or rectangles in cells of excel George A. Yorks Excel Discussion (Misc queries) 1 February 2nd 05 07:07 PM
ClearContents not clearing :( JoeH[_20_] Excel Programming 1 September 27th 04 02:59 AM


All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"