Skip to main content

Range.ColumnWidth property

Table of contents
  1. Syntax
  2. Remarks
  3. Example

Returns or sets the width of all columns in the specified range. Read/write Double.

Syntax

expression.ColumnWidth

expression A variable that represents a Range object.

Remarks

One unit of column width is equal to the width of one character in the Normal style. For proportional fonts, the width of the character 0 (zero) is used.

Use the AutoFit method to set column widths based on the contents of cells.

Use the Width property to return the width of a column in points.

If all columns in the range have the same width, the ColumnWidth property returns the width. If columns in the range have different widths, this property returns null.

Example

The following example doubles the width of column A on Sheet1.

With Worksheets("Sheet1").Columns("A")
    .ColumnWidth = .ColumnWidth * 2
End With

Leave a comment

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

Format your code: <pre><code class="language-vba">place your code here</code></pre>