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