How to add shapes to an Excel spreadsheet using the AddShape method

At the same time, it is such a specific style of language that it is capable of change the position and the size of the object to add.

For this reason, even if at first glance it seems a complicated method to use and understand, here you will find many didactic methods to learn it.

Shortcuts for inserting shapes using the AddShape method

Most of the programs that belong to the Office suite offer the possibility of adding modules to the documents that the person dedicates himself to writing.




Excel for its part uses the term crafts to refer to all those forms that are grouped in the section " Inserisci ”Within the same worksheet.

Each of these objects represents the drawing layers that can be placed within the program as free form or autoform.

In the same way that levels are established. The sequence of the numbers will depend on the order in which each has been entered.

How to add shapes to an Excel spreadsheet using the AddShape method

The term " Shape ”Is used as an index to describe the unique name or number that the shape has to obtain an object once the encoding is positioned.

 

Syntax for adding shapes

Using the AddShape method, the parameters needed to encode shapes in Excel spreadsheets are set.

The expression is established through the format " AddShape (Type, left, top, width, height) ”Which can vary in its values ​​to represent the objects of the shapes. Among which the data are defined as follows:

  • The type is responsible for specifying the type of auto shape of the group you want to create.
  • The left terminology defines the position of the points in the upper left corner of the left square boundary.
  • On the other hand, top defines the top position between the left and right box in relation to the limit it has.
  • The width of the shape is set by the width delimited by the type of shape chosen by the user.
  • Finally, height is the height of the shape enclosed by itself between the points it has.

An example of the type of values ​​and terms you should use is " ActiveSheet.Shapes.AddShape (msoShapeRectangle, 0, 0, 100, 15).Name =” Rectangle ".




To add this code you need to open the Visual Basic Editor in the Microsoft Excel workbook where you want to be added.

This is achieved by pressing the key combination " Alt + F11 "And selecting the button" Inserisci "To enter the" Module ”Where you will enter the complete code of the module.

 

What is the AddShape method?

What this method allows us is to add a shape or an automatic shape which can be found in the tab " Inserisci ”In a specific position on the sheet.


How to add shapes to an Excel spreadsheet using the AddShape method


The syntax for this method is the following "Expression.AddShape (Type, Left, Top, Width, Width, Height)"

  • Type:  type of form we want to insert, there is a list of names of the autoforms that can be inserted.
  • Left and top:  is the position where the shape will be placed relative to its indicator box.
  • Width and Height: allow you to indicate the height and width of the shape also in points.

These 5 parameters are mandatory, it is important that you know what each of them refers to.


Nowadays, being able to use Excel correctly opens many doors. This program consists of multiple tools which are used to keep accounting or the order of some work. Some of the tools you may be interested in learning are knowing how to insert symbols, count cells, or a monthly calendar generator.

 

add a comment of How to add shapes to an Excel spreadsheet using the AddShape method
Comment sent successfully! We will review it in the next few hours.