ColumnBestFit Method

Sets the width of a column to the width of its widest item.

Syntax

*expression.   *ColumnBestFit (Column)

*expression   *     Optional. An expression that returns an Application object.

Column    Optional Long. A number that specifies the column to adjust. Columns are numbered from left to right, starting with 1. If Column is omitted, Microsoft Office Project 2003 adjusts the width of the column that contains the active cell.

Example

The following example adjusts the widths of the first five columns in the active table.

Sub BestFitFirstFiveCols()

    Dim I As Integer        ' Index used in For...Next loop.

    For I = 1 To 5
        ColumnBestFit Column:=I
    Next I

End Sub

Applies to | Application Object

See Also | ColumnAlignment Method | ColumnDelete Method | ColumnEdit Method | ColumnInsert Method | RowDelete Method | RowInsert Method