VBA: Autofit All Columns Used
A popular Yahoo Search the past week has been to Autofit All Columns used in a worksheet from VBA. Combining the VBA to Autofit A Range, Count the Number of Used Columns, and a loop will do just that.
The following code autofits from VBA all used columns:
Sub AutofitAllUsed()
Dim x As Integer
For x = 1 To ActiveSheet.UsedRange.Columns.Count
Columns(x).EntireColumn.autofit
Next x
End Sub



It works! After much searching, I’m very pleased and very grateful!
Wow ! Thanks !