VBA Excel, Alignment

The following article explains the different alignment formattings applicable to cells and ranges and provides reference for more detailed explanation. When right click on a cell and select Format Cells … a dialog will open:

Excel, Formatting Cells and Ranges

The dialog has an alignment tab:

Excel, Formatting, Cells and Ranges, Alignment Tab
The alignment tab displays all the possible alignment formattings applicable to cells and ranges. All these formatting options can be automated using VBA.

Jump To:


Horizontal Alignment:

Horizontal alignment applies to the formatting options provided by the drop down list and indent text box marked in the figure below:

Excel Formatting, Alignment, Horizontal Alignment
For more information about using VBA to apply horizontal alignment formatting please see Excel VBA, Horizontal Alignment.

For examples of using horizontal alignment in VBA please see:


Vertical Alignment:

Horizontal alignment applies to the formatting options provided by the drop down list marked in the figure below:

Excel Formatting, Alignment, Vertical Alignmenta
For more information about using VBA to apply vertical alignment formatting please see Excel VBA, Vertical Alignment.

For examples of using vertical alignment in VBA please see:


Orientation:

Orientation applies to the formatting option provided by the part marked in the figure below:

Excel Formatting, Alignment, Orientation

Using VBA you can do the following:

  • Change the orientation of the content in a cell or range
  • Get the current orientation of the content in a cell or range

For more information about using VBA to apply and get the orientation of cells and ranges please see Excel VBA, Orientation.


Wrap Text, WrapText:

Wrap Text applies to the formatting option provided by the check box below:

Excel, Wrap Text

Using VBA you can do the following:

  • Change the wrap text property of cell or range on and off
  • Get the current wrap text property a cell or range

For more information about using VBA to modify and get the wrap text property of cells and ranges please see Excel VBA, Wrap Text On/Off.


Shrink to Fit, ShrinkToFit:

Shrink to fit applies to the formatting option provided by the check box below:

Excel, Shrink to Fit

Using VBA you can do the following:

  • Change the shrink to fit property of cell or range on and off
  • Get the current shrink to fit property a cell or range

For more information about using VBA to modify and get the shrink to fit property of cells and ranges please see Excel VBA, Shrink to Fit On/Off.


Merge Cells, MergeCells:

Merge cells applies to the formatting option provided by the check box below:

Merge Cells Alignment cells

Using VBA you can do the following:

  • Merge multiple cells and ranges
  • Separate merged cells and ranges

For more information about using VBA to merge and unmerge cells and ranges please see Excel VBA, Merge Cells.


Reading Order:

Reading order applies to the formatting options provided by the drop down list below:

VBA Excel Reading Order

Using VBA you can change the reading order of cells For more information about using VBA to change the reading order of cells and ranges please see Excel VBA, Reading Order.

See Also:

If you need assistance with your code, or you are looking to hire a VBA programmer feel free to contact me. Also please visit my website www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *