Changes the height of the rows in the specified range to achieve the best fit.
[Visual Basic] Sub Autofit() [C#] void Autofit(); [C++] void Autofit(); [JScript] function Autofit();
Use IRange.Autofit method to change the width of the columns in order to achieve the best fit.
This example changes the height of the rows in the used range to achieve the best fit.
[C#]
book.Worksheets[1].UsedRange.Rows.Autofit();
[Visual Basic]
book.Worksheets(1).UsedRange.Rows.Autofit()
[C++]
book->Worksheets->Item[1]->UsedRange->Rows->Autofit();
IRangeRows Interface | NativeExcel Namespace | IRange.Autofit Method | UsedRange Property