vba autofill code example
Example: excel vba autofit
' Autofits all columns / rows of the range
Range("MY_RANGE").EntireColumn.AutoFit
Range("MY_RANGE").EntireRow.AutoFit
' Autofits a single column / row
Range("MY_RANGE").Columns(1).EntireColumn.AutoFit
Range("MY_RANGE").Rows(1).EntireRow.AutoFit