UsedRange Property Example

This example adjusts the row height and column width for the used range on the active worksheet to fit the data contained in the range.

Set ur = Spreadsheet1.ActiveSheet.UsedRange
ur.AutoFitRows
ur.AutoFitColumns