![]() |
Naming Auto Shapes and Creating new Shapes
When you create an AutoShape it is automatically given a name like Oval 1,
Oval 2, etc. Is there a way to change the name that is assigned automatically so that it is more meaningful, similar to range names? Is there a way to find a list of all "shape" names on a particular worksheet? If I wanted to create a special shape, say a smiley face, where the circle could be filled. I would I go about creating, naming, and saving it? |
Naming Auto Shapes and Creating new Shapes
To rename a shape, select the shape, then up where you see its name as Oval
1, Rectangle 2 etc (known as the Name Box) just highlight the current name and type in the name you want it to have. This macro will tell you the names of all shapes on a sheet: Sub GetShapeNames() Dim anyShape As Object For Each anyShape In ActiveSheet.Shapes MsgBox anyShape.Name Next End Sub To put that into code: press [Alt]+[F11], choose Insert | Module from the VB Editor menu and copy that code and paste it into the module. Then access the routine from Tools | Macros | Macro in the main Excel window. I'm afraid someone else will have to tell you how to add new shapes - that's not something I know about, and I don't even know if it can be done. "AL2000" wrote: When you create an AutoShape it is automatically given a name like Oval 1, Oval 2, etc. Is there a way to change the name that is assigned automatically so that it is more meaningful, similar to range names? Is there a way to find a list of all "shape" names on a particular worksheet? If I wanted to create a special shape, say a smiley face, where the circle could be filled. I would I go about creating, naming, and saving it? |
Naming Auto Shapes and Creating new Shapes
Renaming works as you describe. I had tried this but used a space. It appears
that even though the AutoShape names have a space, i.e. Oval 1, Oval 2, etc. You cannot rename with a space. The macro works great. Is there a way to paste them in a separate worksheet? "JLatham" wrote: To rename a shape, select the shape, then up where you see its name as Oval 1, Rectangle 2 etc (known as the Name Box) just highlight the current name and type in the name you want it to have. This macro will tell you the names of all shapes on a sheet: Sub GetShapeNames() Dim anyShape As Object For Each anyShape In ActiveSheet.Shapes MsgBox anyShape.Name Next End Sub To put that into code: press [Alt]+[F11], choose Insert | Module from the VB Editor menu and copy that code and paste it into the module. Then access the routine from Tools | Macros | Macro in the main Excel window. I'm afraid someone else will have to tell you how to add new shapes - that's not something I know about, and I don't even know if it can be done. "AL2000" wrote: When you create an AutoShape it is automatically given a name like Oval 1, Oval 2, etc. Is there a way to change the name that is assigned automatically so that it is more meaningful, similar to range names? Is there a way to find a list of all "shape" names on a particular worksheet? If I wanted to create a special shape, say a smiley face, where the circle could be filled. I would I go about creating, naming, and saving it? |
Naming Auto Shapes and Creating new Shapes
The macro will work on whatever worksheet you have activated at the time you
run it. If you want it to go through all worksheets in a workbook: Sub GetAllShapeNames() Dim anySheet As Worksheets Dim anyShape As Object For Each anySheet in Worksheets For each anyShape In ActiveSheet.Shapes Msgbox AnyShape.Name & " in sheet: " & anySheet.Name Next Next End Sub "AL2000" wrote: Renaming works as you describe. I had tried this but used a space. It appears that even though the AutoShape names have a space, i.e. Oval 1, Oval 2, etc. You cannot rename with a space. The macro works great. Is there a way to paste them in a separate worksheet? "JLatham" wrote: To rename a shape, select the shape, then up where you see its name as Oval 1, Rectangle 2 etc (known as the Name Box) just highlight the current name and type in the name you want it to have. This macro will tell you the names of all shapes on a sheet: Sub GetShapeNames() Dim anyShape As Object For Each anyShape In ActiveSheet.Shapes MsgBox anyShape.Name Next End Sub To put that into code: press [Alt]+[F11], choose Insert | Module from the VB Editor menu and copy that code and paste it into the module. Then access the routine from Tools | Macros | Macro in the main Excel window. I'm afraid someone else will have to tell you how to add new shapes - that's not something I know about, and I don't even know if it can be done. "AL2000" wrote: When you create an AutoShape it is automatically given a name like Oval 1, Oval 2, etc. Is there a way to change the name that is assigned automatically so that it is more meaningful, similar to range names? Is there a way to find a list of all "shape" names on a particular worksheet? If I wanted to create a special shape, say a smiley face, where the circle could be filled. I would I go about creating, naming, and saving it? |
All times are GMT +1. The time now is 08:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com