ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting All AutoShapes on a Worksheet (https://www.excelbanter.com/excel-programming/299735-selecting-all-autoshapes-worksheet.html)

Alan

Selecting All AutoShapes on a Worksheet
 

Hi All,

I am trying to write a small sub that will select all the shapes on a
worksheet.

The code I have below *seems* to create the array, but how do I then
use that array to actually select the shapes?

The four lines I hav commented out are the ones I am struggling with -
those are my attempts, but they all error out.

I am using Excel 2000 under Win 2000 Pro with all updates and service
packs installed.

Thanks,

Alan.


+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-




Sub SelectAllShapes()


Dim Counter As Integer
Dim MyShape As Shape
Dim CurrentShape As Shape
Dim ShapesCollection() As Variant


Counter = 1

For Each MyShape In ActiveSheet.Shapes

Set CurrentShape = ActiveSheet.Shapes(Counter)

ReDim Preserve ShapesCollection(Counter)

Set ShapesCollection(Counter - 1) = CurrentShape

Counter = Counter + 1

Next MyShape



'ActiveSheet.ShapesCollection.Select

'ActiveSheet.Shapes.Range(ShapesCollection).Select

'ActiveSheet.Shapes.Array(ShapesCollection).Select

'ActiveSheet.Shapes.Range(Array(ShapesCollection)) .Select


End Sub




Alan

Selecting All AutoShapes on a Worksheet
 
"Alan" wrote in message
...

I am trying to write a small sub that will select all the shapes on

a
worksheet.


Never mind!

ActiveSheet.Shapes.SelectAll


Talk about trying to over complicate things!

Thanks,

Alan.




All times are GMT +1. The time now is 05:09 PM.

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