CellFormat.VerticalAlignment Property

Excel Developer Reference

Returns or sets a Variant value that represents the vertical alignment of the specified object.

Syntax

expression.VerticalAlignment

expression   A variable that represents a CellFormat object.

Remarks

The value of this property can be set to one of the following constants:

xlBottom
xlCenter
xlDistributed
xlJustify
xlTop

Example

This example sets the height of row 2 on Sheet1 to twice the standard height and then centers the contents of the row vertically.

Visual Basic for Applications
  Worksheets("Sheet1").Rows(2).RowHeight = _
    2 * Worksheets("Sheet1").StandardHeight
Worksheets("Sheet1").Rows(2).VerticalAlignment = xlVAlignCenter

See Also