Tuesday, 2 June 2020

How to use Orientation in Excel VBA

In this blog post, you will learn about “How to apply Orientation in Excel VBA”.


In this blog post, you will learn about “How to apply Orientation in Excel VBA”.

First of all, we need to know what is Orientation in Excel, so ‘Orientation’ is nothing but “aligning or rotating our text data in a cell”.

See the image below:-



See in the above image, our text data is rotating in 4 different direction.

In this post, you will learn more VBA option to rotate or align our text data.

I am using the below image as the text data:-


Orientation


Our first option to rotate the text data from bottom to upward.

Option 01:- xlUpward






Code: -           Range ("A1:B1").Orientation = xlUpward

This code rotates our whole dataset from bottom to upward.


Option 02:- xlDownward

Code:- Range ("A1:B1").Orientation = xlDownward

This code will rotate our text data from upward to downward




Option 03:- xlVertical

Code:- Range ("A1:B1").Orientation = xlVertical

This code turns our whole dataset as vertical


    




Option 04:- xlHorizontal

This code will turn our whole dataset as horizontal

Code: - Range ("A1:B1").Orientation = xlHorizontal




Option 05:- Orientation = 30 (Degree)

This code will rotate our text data up to a 30-degree angle.

Code: - Range ("A1:B1").Orientation = 30






Option 06:- Orientation = 60 (Degree)

This code will rotate our text data up to a 60-degree angle.

Code: - Range ("A1:B1").Orientation = 60




Option 07:- Orientation = 90 (Degree)

This code will rotate our text data up to (90) degree angle.

Code: - Range ("A1:B1").Orientation = 90



Option 08:- Orientation = -90 (Degree)

This code will rotate our text data up to (-90) degree angle.

Code: - Range ("A1:B1").Orientation = -90



Option 09:- Orientation = 0 (Degree)

This code will rotate our text data up to (0) degree or Horizontal.

Code: - Range ("A1:B1").Orientation = 0




I hope you like this post.


Please feel free to put your comments below.


Regards


How to Change Font Color in Excel VBA

How to Change the Background Color in Excel VBA

Easiest Way to Copy and Paste Data in Excel VBA

How to Apply Border Style and Thickness in Excel VBA

How to Clear Cell Formatting in Excel VBA

Text Alignment in Excel VBA


Featured post

Pivot Tables