AutoFit Method
The document is archived and information here might be outdated

AutoFit Method

Office 2007

Changes the width of the columns in the specified range to achieve the best fit.

expression.AutoFit

Remarks

One unit of column width is equal to the width of one character in the Normal style.

Example

This example changes the width of columns A through I on the datasheet to achieve the best fit.

myChart.Application.DataSheet.Columns("A:I").AutoFit

This example changes the width of columns A through E on the datasheet to achieve the best fit, based only on the contents of cells A1:E1.

myChart.Application.DataSheet.Range("A1:E1").Columns.AutoFit



Show:
© 2016 Microsoft