LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default XL2002 - Select All Objects in an Array...

I have some code that draws a variable amount of lines to a worksheet. Each
time a line is drawn it is given a sequential name (myShelf1, myShelf2...
etc) and the width of the line changed to a value specified on the worksheet.

Here's what I need...
1. I need to be able to start the lines at the edge of a pre-defined
rectangle called myFixture.

2. I need to be able to select all lines that are called myShelf*, plus 2
other pre-defined lines (myShelfTop & myShelfBottom), and then distribute
them vertically.

As usual, any help greatly appreciated.

my code so far...

----------------------------
Sub AddShelves()

'clear current shelves
For Each shp In ActiveSheet.Shapes
If shp.Name Like "myShelf*" Then
shp.Delete
End If
Next shp

'add new shelves
For i = 1 To Range("D17").Value 'this is how many lines to add
With ActiveSheet
.Shapes.AddLine(335.25, 127.5, 623.25, 127.5).Name = ("myShelf") & i
.Shapes("myShelf" & i).Width = Range("myLength")
End With
Next i

'distribute shelves - ShelfTop & ShelfBottom are predefined
ActiveSheet.Shapes.Range(Array("ShelfTop", "ShelfBottom", "myShelf1",
"myShelf2", "myShelf3")) _
.Distribute msoDistributeVertically, False

End Sub
------------------------
 
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
Cannot select objects Blue Max New Users to Excel 6 March 23rd 09 12:47 PM
Select Objects cursor Learning Excel 2007 Excel Discussion (Misc queries) 2 May 2nd 07 05:09 PM
how can I select multiple drawing objects at once ExcelUser Excel Discussion (Misc queries) 1 February 11th 05 10:42 AM
The Select Objects button Max Power Excel Programming 1 November 30th 04 12:55 PM
Select Multiple Shape Objects Alan Excel Programming 0 November 24th 04 06:25 AM


All times are GMT +1. The time now is 10:20 PM.

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"