How to Wrap Text in Excel VBA?

In this post, you will learn how to wrap text in Excel VBA with some examples showing how to apply them in your excel spreadsheet.

Wrapping Text using VBA

To wrap the text in VBA, you can use Range.WrapText Property of the Range object.

Wrapping Text

Code:

Worksheets("Sheet1").Range("A1").WrapText = True

To wrap a range of cells

Code:

Range("A1:A10").WrapText = True

Disabling Wrapping in a Cell using VBA

To disable Wrapping.

Code:

Range("A1").WrapText = False

Disabling Wrapping in An Entire Worksheet

To disable wrapping in an Entire Worksheet,

Code:

Sub DisableWrapText()
 Cells.WrapText = False
End Sub

Leave A Reply

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

You May Also Like

In this article, you will learn about the SKEW.P function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the SKEW function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the RANK.EQ function, the formula syntax and usage of the function in Microsoft...
  • Excel
  • November 23, 2021