ALIGNMENT

Macro Sheets Only

Equivalent to choosing the Alignment tab in the Format Cells dialog box, which is displayed when you choose the Cells command from the Format menu. Aligns the contents of the selected cells.

Syntax

ALIGNMENT(horiz_align, wrap, vert_align, orientation, add_indent)
ALIGNMENT?(horiz_align, wrap, vert_align, orientation, add_indent)

Horiz_align is a number from 1 to 7 specifying the type of horizontal alignment, as shown in the following table. If horiz_align is omitted, horizontal alignment does not change.

Horiz_align Horizontal alignment

1 General

2 Left

3 Center

4 Right

5 Fill

6 Justify

7 Center across selection

Wrap is a logical value corresponding to the Wrap Text check box in the Alignment tab. If wrap is TRUE, Microsoft Excel selects the check box and wraps text in cells; if FALSE, Microsoft Excel clears the check box and does not wrap text. If wrap is omitted, wrapping does not change.

Vert_align is a number from 1 to 4 specifying the vertical alignment of the text. If vert_align is omitted, vertical alignment does not change.

Vert_align Vertical alignment

1 Top

2 Center

3 Bottom

4 Justify

Orientation is a number from 0 to 4 specifying the orientation of the text. If orientation is omitted, text orientation does not change.

Orientation Text orientation

0 Horizontal

1 Vertical

2 Upward

3 Downward

4 Automatic (applies to only chart tick labels)

Add_indent This argument is for only Far East versions of Microsoft Excel.

Related Function

FORMAT.TEXT Formats a worksheet text box or a chart text item

List of Command-Equivalent Functions