Selecting all Shape(s) within the ActiveCell


Posted by Bill J on September 03, 2000 5:24 AM

Is there an efficient way to select all of the drawing objects within the current cell into a ShapeRange? My worksheet has several hundred drawing objects. Some cells may contain up to 12 drawing objects. I need to find all of the drawing objects which are located within the ActiveCell.

I could do this using the following code by looping through all of the shapes on the sheet, but is there anything more efficient?
Dim TheseShapes(1 To 12) As Variant
Counter = 1
ThisRow = Selection.Row
ThisCol = Selection.Column
For Each sh In ActiveSheet.Shapes
If sh.TopLeftCell.Row = ThisRow Then
If sh.TopLeftCell.Column = ThisCol Then
TheseShapes(Counter) = sh.Name
Counter = Counter + 1
End If
End If
Next
ActiveSheet.Shapes.Range(TheseShapes).Select

Thanks for any help.



Posted by Ivan Moala on September 04, 0100 1:55 AM


Bill
If all you want to do is select the shapes
in a cell then this maybe OK;

ThisRow = Selection.Row
ThisCol = Selection.Column
For Each Sh In ActiveSheet.Shapes
If Sh.TopLeftCell.Row = ThisRow And Sh.TopLeftCell.Column = ThisCol Then
Sh.Select False
End If
Next

Ivan