In Excel if you double-click a column on its right "border" you can auto-size the width to be the width of the largest value in that column.
How does one replicate this in VBA?
In Excel if you double-click a column on its right "border" you can auto-size the width to be the width of the largest value in that column.
How does one replicate this in VBA?
You can use the Macro Recorder to perform the action & see;
<range>.entirecolumn.autofit
Call the AutoFit
Method of a Column
object.
Like so:
ActiveSheet.UsedRange.Columns.AutoFit
or like so:
Columns("A:A").EntireColumn.AutoFit