Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I create a macro that autosizes all columns of every tab in the
workbook? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following code will autofit the columns on all worksheets:
Sub Macro1() Dim i As Integer For i = 1 To Sheets.Count Sheets(i).Select Cells.Select Selection.Columns.AutoFit Next i End Sub David "SweetJebus" wrote in message ... How do I create a macro that autosizes all columns of every tab in the workbook? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi David,
It is rarely necessary, and usually inefficient. to make selections. To allow for possible hidden worksheets or the presence of sheets other than worksheets, perhaps try: '============= Public Sub Macro1() Dim i As Long For i = 1 To Sheets.Count Sheets(i).Columns.AutoFit Next i End Sub '<<============= --- Regards, Norman "Dove" wrote in message ... The following code will autofit the columns on all worksheets: Sub Macro1() Dim i As Integer For i = 1 To Sheets.Count Sheets(i).Select Cells.Select Selection.Columns.AutoFit Next i End Sub David "SweetJebus" wrote in message ... How do I create a macro that autosizes all columns of every tab in the workbook? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
autosize | Excel Programming | |||
Autosize textframe | Excel Programming | |||
Autosize Row Heights | Excel Discussion (Misc queries) | |||
Macro to insert a row, copy info from another row and autosize the row | Excel Programming | |||
comments AutoSize | Excel Programming |