I'd like to autofit columns but not allow the column width to exceed 40 (as some may be 255)... any ideas please?
Here's an extract of what I have now:
Here's an extract of what I have now:
Code:
Dim lastCol As Integer
Dim lastRow As Integer
With ActiveSheet
' find position of entire table including headings
lastCol = .Range("A1").End(xlToRight).Column
lastRow = .Range("A1").End(xlDown).Row
endTable = .Cells(lastRow, lastCol).Address
' Resize rows & columns
'.Cells.EntireRow.AutoFit
Rows("1:" & lastRow).RowHeight = 15
'Columns("A:E").ColumnWidth = 40
.Cells.EntireColumn.AutoFit
end with
Last edited: