Align Method

Microsoft Excel Visual Basic

Aligns the shapes in the specified range of shapes.

expression.Align(AlignCmd, RelativeTo)

expression    Required. An expression that returns one of the objects in the Applies To list.

AlignCmd   Required MsoAlignCmd. Specifies the way the shapes in the specified shape range are to be aligned.

MsoAlignCmd can be one of these MsoAlignCmd constants.
msoAlignCenters
msoAlignMiddles
msoAlignTops
msoAlignBottoms
msoAlignLefts
msoAlignRights

RelativeTo   Required MsoTriState. Not used in Microsoft Excel. Must be False.

MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse
msoTriStateMixed
msoTriStateToggle
msoTrue

Example

This example aligns the left edges of all the shapes in the specified range in myDocument with the left edge of the leftmost shape in the range.

Set myDocument = Worksheets(1)
myDocument.Shapes.SelectAll
Selection.ShapeRange.Align msoAlignLefts, False