Select multiple Shapes

G

Guest

Hi All........
Is it possible with code, to be able to select multiple or ALL of the shapes
or drawing objects on a sheet? How about "ranges" like "Line1:Line17", or
"Rectangle36:Rectangle56", or even "all the rectangles listed in G1:G17", or
something like that?

Vaya con Dios,
Chuck CABGx3
 
N

Norman Jones

Hi CLR,

ActiveSheet.DrawingObjects.Select
ActiveSheet.Rectangles.Select
ActiveSheet.Lines.Select
ActiveSheet.Ovals.Select

To limit the collection to a range, I think that you would need to loop
through each, checking the intersection of the shape's TopLeftCell (and
possibly its BottomRightCell) with the range.
 
G

Guest

Thanks Norman, your suggestion for that first part helps a bunch!

As for the second part, I am not wanting to select all the shapes within an
"Excel cell range", (like A1:G17), rather I want to select "all the
rectangles within the group of Rectangle numbers from Rectangle 1 through
Rectangle 7"......or Group of Rectangle12:24........etc

Vaya con Dios,
Chuck, CABGx3
 
N

Norman Jones

Hi Chuck,

Try something like:

'=============>>
Public Sub Tester03()
Dim i As Long

For i = 1 To 7
ActiveSheet.Rectangles("rectangle " & i).Select False
Next i
End Sub
'<<=============
 
N

Norman Jones

Hi Chuck,

Better would be:

'=============>>
Public Sub Tester03()
Dim i As Long
Dim j As Long

For i = 1 To 3
j = j + 1
ActiveSheet.Rectangles("rectangle " & i).Select Replace:=j = 1
Next i
End Sub
'<<=============
 
G

Guest

Thanks Norman.........this one got the job done, I just had to modify a bit
for my XL97 I guess....

ActiveSheet.SHAPES("rectangle " & i).Select Replace:=j = 1

Thanks again,
Vaya con Dios,
Chuck, CABGx3
 

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

Top