ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Selecting Autoshapes in Excel 2003 (https://www.excelbanter.com/excel-discussion-misc-queries/188534-selecting-autoshapes-excel-2003-a.html)

Varne

Selecting Autoshapes in Excel 2003
 
Hello!

If we select an autoshape object in Excel 2003 for instance a rectangle on
sheet1 something like 'Activesheet.Shapes("Rectangle 6").Select will get
written on Visual Basic coding sheets. The problem to me is this code would
not work if that rectangle was replaced with an other one because the new one
will be "Rectangle7".

Can an expert help me on this?

Thanks.

Varne M

L. Howard Kittle

Selecting Autoshapes in Excel 2003
 
Hi Varne,

Not an expert but this may help. I entered several rectangles on a sheet
and then named then, Rec1, Rec2, Rec3 etc.

Then I made a list in an unused column of the Rec's. In a adjacent cell I
made a drop down using the list of Rec's as source. Select a Rec in F1 and
run this macro and it should select that Rec.

Sub ShapeSelect()
Dim i As Variant
i = Range("F1").Value
ActiveSheet.Shapes(i).Select
End Sub

HTH
Regards
Howard

"Varne" wrote in message
...
Hello!

If we select an autoshape object in Excel 2003 for instance a rectangle on
sheet1 something like 'Activesheet.Shapes("Rectangle 6").Select will get
written on Visual Basic coding sheets. The problem to me is this code
would
not work if that rectangle was replaced with an other one because the new
one
will be "Rectangle7".

Can an expert help me on this?

Thanks.

Varne M




Varne

Selecting Autoshapes in Excel 2003
 
Hi Howard

That is enough.

Thank you.

M varnendra

"L. Howard Kittle" wrote:

Hi Varne,

Not an expert but this may help. I entered several rectangles on a sheet
and then named then, Rec1, Rec2, Rec3 etc.

Then I made a list in an unused column of the Rec's. In a adjacent cell I
made a drop down using the list of Rec's as source. Select a Rec in F1 and
run this macro and it should select that Rec.

Sub ShapeSelect()
Dim i As Variant
i = Range("F1").Value
ActiveSheet.Shapes(i).Select
End Sub

HTH
Regards
Howard

"Varne" wrote in message
...
Hello!

If we select an autoshape object in Excel 2003 for instance a rectangle on
sheet1 something like 'Activesheet.Shapes("Rectangle 6").Select will get
written on Visual Basic coding sheets. The problem to me is this code
would
not work if that rectangle was replaced with an other one because the new
one
will be "Rectangle7".

Can an expert help me on this?

Thanks.

Varne M






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

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