Thread: Autofit
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Autofit

this worked for me

Sub col()
Dim sh As Worksheet
On Error Resume Next
For Each sh In ThisWorkbook.Sheets
Columns("A:A").Select
Range(Selection, Selection.End(xlToRight)).Select
Columns.AutoFit
Next
End Sub

--


Gary


"Jentan" wrote in message
oups.com...
Hi,

I have this aotufit command but it doesn't really work.

Sub col()

On Error Resume Next
'For Each ws In Workbooks("bbl.xls").Sheets


For Each Sh In Workbooks("bbl.xls")
Columns("A:A").Select
Range(Selection, Selection.End(xlToRight)).Select
Columns.AutoFit
'ActiveSheet.ActivateNext

Next

End Sub


I am trying to make an automatic "autofit" to each of the tabs in a
workbook irregardless of the tab name and number of column in each of
the tab.

Can I have a command that can work? Thank you.