ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AutoFit (https://www.excelbanter.com/excel-programming/396415-autofit.html)

Howard Kaikow

AutoFit
 
The problem described in http://support.microsoft.com/kb/214394 seems to
prevent AutoFit from working as expected.

Is there a progammatic solution?

I tried

With wst.Columns.EntireColumn
.Font.Name = "Courier New"
.AutoFit
End With

Still required manual adjustment.

One approach, too ugly to use, might be to search for the largest cell in
each column and adjust the column size.
Is there a better way?

--
http://www.standards.com/; See Howard Kaikow's web site.



Jim Cone

AutoFit
 

Howard,
Something to try...
Make the columns wider than the text, then do the autofit...
'--
Sub JustRight()
ActiveSheet.UsedRange.Columns.EntireColumn.ColumnW idth = 150
ActiveSheet.UsedRange.Columns.EntireColumn.AutoFit
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Howard Kaikow"

wrote in message
The problem described in http://support.microsoft.com/kb/214394 seems to
prevent AutoFit from working as expected.
Is there a progammatic solution?
I tried
With wst.Columns.EntireColumn
.Font.Name = "Courier New"
.AutoFit
End With
Still required manual adjustment.
One approach, too ugly to use, might be to search for the largest cell in
each column and adjust the column size.
Is there a better way?
--
http://www.standards.com/; See Howard Kaikow's web site.



Howard Kaikow

AutoFit
 
"Jim Cone" wrote in message
...

Howard,
Something to try...
Make the columns wider than the text, then do the autofit...
'--
Sub JustRight()
ActiveSheet.UsedRange.Columns.EntireColumn.ColumnW idth = 150
ActiveSheet.UsedRange.Columns.EntireColumn.AutoFit
End Sub


thanx.

I would expect that would result in the same issue as raised in te KB
article, i.e., the difference 'tween sceen and print fonts.

In any case, I got an unable to set ColumnWidth of Range upject using vrious
forms, including:

ExcelWbk.ActiveSheet.UsedRange.Columns.EntireColum n.ColumnWidth = 700



Howard Kaikow

AutoFit
 
I see the problem.

The max size of a column is 255, so I cannot make the column large enough.



Jim Cone

AutoFit
 

Maximum column width is 255.
Jim Cone


"Howard Kaikow"

wrote in message

thanx.
I would expect that would result in the same issue as raised in te KB
article, i.e., the difference 'tween sceen and print fonts.
In any case, I got an unable to set ColumnWidth of Range upject using vrious
forms, including:
ExcelWbk.ActiveSheet.UsedRange.Columns.EntireColum n.ColumnWidth = 700




All times are GMT +1. The time now is 08:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com