shapesobjects numbering

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » SHAPES/OBJECTS NUMBERING

SHAPES/OBJECTS NUMBERING

resolvedResolved · Low Priority · Version 2003

Tony has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course
Access Intermediate course
Access Advanced course

SHAPES/OBJECTS NUMBERING

I have a spreadsheet that uses Auto Shapes to produce a project milestone chart. The position of the object is determeined by a date in a cell. At the moment, I update the chart by deleting all the shapes and running the macro again to redraw the auto shapes. Every time the auto shapes are drawn, they get a new number. This is not a major issue but the delete shape macro does use the shape identity number to delete it. As I do not know what the number is I use a broad for next loop with an error trap to delete the shapes. Is it possible to reset the numbering so that the next set of auto shape identities start at 1 or is it possible to set the name of the shape so that I can either delete or move only the ones that need to move.


Tony

RE: SHAPES/OBJECTS NUMBERING

Hi Tony

Thanks for your question

This is pretty straightforward. The following line of code sets the name property of the first shape in the sheet.


Dim shp As Shape

Set shp = ActiveSheet.Shapes(1)

shp.Name = "Test"

MsgBox shp.Name



Hope this helps

Regards

Stephen

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Copying the same value, label or formula quickly into a range of selected cells.

Select your range of cells. Type the value, label or formula that you want to appear in all the selected cells and then press Ctrl+Enter.

View all Excel hints and tips


Server loaded in 0.08 secs.