VBA Wrap Text
Written by
Reviewed by
In this Article
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:
Worksheets("Sheet1").Range("A1").WrapText = True
The result is:
You can Wrap a larger range of cells as well:
Range("A1:A10").WrapText = True
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:
Range("B2").WrapText = False
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:
Sub DisableWrapText ()
Cells.WrapText = False
End Sub
VBA Coding Made Easy
Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!Learn More!