I am trying to set the column width (FCol) to accommodate the largest number in the Row (FRow). I can't use AutoFit.
Using the Function below, I set the width at 75% of the length of format of the value in the cell (A$). It works great on my machine but fails on others machines with different display units.
I am looking for a way that will work on any display.
Help, Thanks you, Jim.
Function CheckWidth(FRow, FCol)
Columns(FCol).Select: K = Selection.ColumnWidth: ColPct = 0.75
Cells(FRow, FCol).Select: A$ = ActiveCell
B$ = Format(A$, "$* #,##0.00")
L = Int(Len(B$) + 1) * ColPct
If L > K Then
Columns(FCol).Select: Selection.ColumnWidth = L + 1
End Function 'CheckWidth
This question generated 14 answers. To proceed to the answers, click here.
This thread is current as of September 02, 2014.