Column width

  • Thread starter Thread starter =?iso-8859-1?B?QW5kcuk=?=
  • Start date Start date
?

=?iso-8859-1?B?QW5kcuk=?=

So i have my data validation working, now is there a way
to have the columns automaticly adjust to the right width
depending on the data that is selected for the cell?

A.
 
try this

Sub colsize()

Columns("a:iv").Select
Columns("a:iv").EntireColumn.AutoFit
Range("a1").Select

End Sub
 
Can i have this macro run automaticly either when the
spreadsheet is opened or closed?

A.
 
One way:

Put this in the ThisWorkbook code module:

Public Sub Workbook_Open()
Cells.EntireColumn.AutoFit
End Sub

Note that there's no need to select the columns.
 
Back
Top