VBA Wrap Text

Associated Files Download Links

In this tutorial, you will learn about how to enable or disable Wrap Text in Excel using VBA.

Wrapping Text using VBA

You wrap the text in a cell or range by setting the Range.WrapText Property of the Range object to True. The following code will wrap the text in cell A1:

The result is:

Wrapping Text in VBA

You can Wrap a larger range of cells as well:

 

Disabling Wrapping in a Cell using VBA

You can disable text wrapping in a certain cell or range using VBA. The following code will disable text wrapping in cell B2:

Disabling Wrapping in An Entire Worksheet

You can disable text wrapping in all the cells on a worksheet using VBA. The following code will allow you to disable text wrapping in all the cells in the ActiveSheet:

You may also like some of this related content...

Ads