expression.AutoFit
expression Required. An expression that returns a Range object. Must be a row or a range of rows, or a column or a range of columns. Otherwise, this method generates an error.
Example
This example adjusts the selected rows and columns to the best fit.
Sub AutoFitSelection()
Dim rngSelected
Set rngSelected = Spreadsheet1.Selection
rngSelected.Rows.AutoFit
rngSelected.Columns.AutoFit
End Sub