ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select multiple Shapes (https://www.excelbanter.com/excel-programming/363444-select-multiple-shapes.html)

CLR

Select multiple Shapes
 
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



Norman Jones

Select multiple Shapes
 
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.

---
Regards,
Norman



"CLR" wrote in message
...
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





CLR

Select multiple Shapes
 
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






"Norman Jones" wrote:

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.

---
Regards,
Norman



"CLR" wrote in message
...
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






Norman Jones

Select multiple Shapes
 
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
'<<=============



---
Regards,
Norman



"CLR" wrote in message
...
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






"Norman Jones" wrote:

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.

---
Regards,
Norman



"CLR" wrote in message
...
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








Norman Jones

Select multiple Shapes
 
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
'<<=============


---
Regards,
Norman



"Norman Jones" wrote in message
...
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
'<<=============



---
Regards,
Norman



"CLR" wrote in message
...
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






"Norman Jones" wrote:

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.

---
Regards,
Norman



"CLR" wrote in message
...
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










CLR

Select multiple Shapes
 
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




"Norman Jones" wrote:

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
'<<=============


---
Regards,
Norman



"Norman Jones" wrote in message
...
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
'<<=============



---
Regards,
Norman



"CLR" wrote in message
...
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






"Norman Jones" wrote:

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.

---
Regards,
Norman



"CLR" wrote in message
...
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












All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com