Excel Macro: Turning Off the Wrap Text on Active Sheet

This Excel VBA macro turns off the wrap text check-box on an active worksheet.

Macro Example

Sub TurningOffWrapText()

  Cells.WrapText = False

End Sub

Description

  Cells.WrapText = False

[Application.]Cells

  Cells...

The Application.Cells property returns the Range object represents ALL ranges on an active sheet.
So we don’t have to loop through.

obj-Excel-Application-Cells

The Cells property is a member of the Excel.Global class, so we can omit the Application property.

obj-Excel-Cells

Range.WrapText

  Cells.WrapText...

The Range.WrapText property returns or sets a Variant value that indicates if Excel wraps the text in a cell.

obj-Excel-Range-WrapText

This property returns True if the text is wrapped, False if the text isn’t wrapped, or Null if the range contains some cells that wrap text and other cells that don’t.

Sub TurningOffWrapText()

  Cells.WrapText = False

End Sub

Properties

http://www.relief.jp/itnote/archives/excel-vba-off-wrap-text.php

Apply to

  • Excel 2013
  • Excel 2010
  • Excel 2007