VerticalAlignment Property
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
XlVAlign
XlVAlign can be one of these XlVAlign constants. |
xlVAlignCenter |
xlVAlignLeft |
xlVAlignRight |
expression.VerticalAlignment
expression Required. An expression that returns a Range object.
Example
This example top-aligns the contents of cells C7:G10 on Sheet1 in Spreadsheet1.
Sub SetAlignment()
Dim rngAlign
Dim ssConstants
Set ssConstants = Spreadsheet1.Constants
Set rngAlign = Spreadsheet1.Worksheets("Sheet1").Range("C7:G10")
' Center the contents of the range horizontally.
rngAlign.HorizontalAlignment = ssConstants.xlHAlignCenter
' Vertically align the contents of the range at the top of the cells.
rngAlign.VerticalAlignment = ssConstants.xlVAlignTop
End Sub