Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

shapesobjects numbering

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

SHAPES/OBJECTS NUMBERING

ResolvedVersion 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:

Using Excel's MODE function

Use Excel's MODE function to display the most common value present in a particular range of cells.

The Mode function looks like this:

=MODE(cell range)

As an example, if 35 is the most commonly recurring number in a particular cell range, then the function will display 35.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.