Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default How do I name an autoshape so that I can refer to it in a macro?

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default How do I name an autoshape so that I can refer to it in a macro?

One way. Select the shape and look in the NAME box to the left of the
formula box. Change the name there.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How do I name an autoshape so that I can refer to it in a macro?

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

--
Gary''s Student - gsnu200789
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How do I name an autoshape so that I can refer to it in a macro?

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.

Stacy wrote:

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.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoShape Macro Help jack[_2_] Excel Programming 12 April 13th 08 02:39 PM
autoshape macro jackrobyn1 Excel Discussion (Misc queries) 1 October 13th 07 11:33 PM
Autoshape Macro Jim Rech Excel Programming 3 August 16th 05 10:24 PM
macro in vba to display autoshape jrd269[_6_] Excel Programming 0 June 7th 05 08:45 PM
AutoShape name assigned to macro Larry Excel Programming 4 October 19th 04 04:15 PM


All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"