Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

How do I name an autoshape so that I can refer to it in a macro?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stacy - 28 May 2008 14:56 GMT
I'm trying to create a macro that changes the color of different autoshapes
depending on the values of certain cells.  Each autoshape would change,
depending on the value of a different cell.  So, I need to refer to each
autoshape separately.  When I recorded the macro, it refers to "Rectangle
220" for every rectangle, so when I run it, it only changes the first
rectangle to the correct color.
Don Guillett - 28 May 2008 15:01 GMT
One way. Select the shape and look in the NAME box to the left of the
formula box. Change the name there.

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

> I'm trying to create a macro that changes the color of different
> autoshapes
[quoted text clipped - 3 lines]
> 220" for every rectangle, so when I run it, it only changes the first
> rectangle to the correct color.
Gary''s Student - 28 May 2008 15:04 GMT
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/28/2008 by James Ravenswood
'

'
   ActiveSheet.Shapes.AddShape(msoShapeOval, 204#, 135.75, 57.75,
61.5).Select
   ActiveSheet.Shapes(1).Name = "stacy"
   Range("A1").Select
End Sub

Signature

Gary''s Student - gsnu200789

Dave Peterson - 28 May 2008 18:28 GMT
If you've already added the shapes, you can select them (one at a time) and
change their name in the namebox -- to the left of the formulabar.

Remember to hit enter when you've finished typing the new name.

> I'm trying to create a macro that changes the color of different autoshapes
> depending on the values of certain cells.  Each autoshape would change,
> depending on the value of a different cell.  So, I need to refer to each
> autoshape separately.  When I recorded the macro, it refers to "Rectangle
> 220" for every rectangle, so when I run it, it only changes the first
> rectangle to the correct color.

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.