ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting Drawing Object By Name (https://www.excelbanter.com/excel-programming/379945-selecting-drawing-object-name.html)

Zone

Selecting Drawing Object By Name
 
I have several drawing objects on a worksheet. I have assigned each of
them a name. How do select the object by using its name in VBA code?
Excel 2002. TIA, James


Gary Keramidas

Selecting Drawing Object By Name
 
i named a shape square.

activesheet.shapes("square").select

--


Gary


"Zone" wrote in message
ps.com...
I have several drawing objects on a worksheet. I have assigned each of
them a name. How do select the object by using its name in VBA code?
Excel 2002. TIA, James




John Coleman

Selecting Drawing Object By Name
 
Dim shp as Shape
Set shp = ActiveSheet.Shapes("name")
shp.Select

But - if you use a shape variable like this you can probably do what
you want directly with shp rather than Selection. If you want to just
select then

ActiveSheet.Shapes("name").Select

works

HTH

-John Coleman

Zone wrote:
I have several drawing objects on a worksheet. I have assigned each of
them a name. How do select the object by using its name in VBA code?
Excel 2002. TIA, James



Zone

Selecting Drawing Object By Name
 
Thank you, Gary. Turning record on and selecting the shape gave me the
same answer! Guess I was having a senior moment there. <g Happy
Holidays! James
Gary Keramidas wrote:
i named a shape square.

activesheet.shapes("square").select

--


Gary


"Zone" wrote in message
ps.com...
I have several drawing objects on a worksheet. I have assigned each of
them a name. How do select the object by using its name in VBA code?
Excel 2002. TIA, James




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

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