Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column Size 1

Status
Not open for further replies.

simoncpage

Programmer
Apr 4, 2002
256
GB
Is there any way of autosizing a table and making all the columns widths equal to the largest column that autosize finds??

Any help would be very useful
 
not without code.....but here is the code
Select the columns then run. Obviously, if you are going to do it on 1 table all the time, the variables can be hardcoded
Sub MaxcolSize()
Widest = 0
Selection.EntireColumn.AutoFit
For i = 1 To Selection.Columns.Count
tWidth = Selection.Columns(i).ColumnWidth
If tWidth > Widest Then
Widest = tWidth
Else
End If
Next i
Selection.ColumnWidth = Widest
End Sub

HTH
Geoff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top