HorizontalAlignment 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.  

XlHAlign

XlHAlign can be one of these XlHAlign constants.
xlHAlignGeneral
xlHAlignCenter
xlHAlignLeft
xlHAlignRight

 

expression.HorizontalAlignment

expression   Required. An expression that returns a Range object.

Example

This example left-aligns the range A1:A5 on Sheet1.


Sub AlignRange()

Dim ssConstants Set ssConstants = Spreadsheet1.Constants

Worksheets("Sheet1").Range("A1:A5").HorizontalAlignment = ssConstants.xlHAlignLeft

End Sub