Alignment Property

The Alignment property returns or sets the horizontal alignment in worksheet cells. A null is returned if the cells in a range have the varying horizontal alignments. Returns a variant.

 

Syntax

object.Alignment

object.Alignment = Alignment

 

Parameter

Type

Description

Alignment

wksAlign

required; cell alignment style

 

Example 1

This example demonstrates how to return the horizontal alignment of cells.

 

Debug.Print WksCellFormat. Alignment

 

Example 2

This example demonstrates how to center cell values.

 

WksCellFormat. Alignment = wksAlignCenter

 

Used by: WksCellFormat object