PDA

View Full Version : Solved: Autofit alternating sizes



Djblois
02-13-2007, 11:58 AM
Now I am autofiting the columns but they can be all different sizes. This is what I have so far and it doesn't work.

Range("A2:1" & finalColumn).AutoFit

Marcster
02-13-2007, 12:10 PM
Columns("A:" & finalColumn).AutoFit

Marcster.

CBrine
02-13-2007, 12:10 PM
I think your range reference is kinda messed up.

Try this.

Range("A2", Cells(1, finalcolumn)).EntireColumn.AutoFit


HTH
Cal

CBrine
02-13-2007, 12:12 PM
Djblois,
Is you finalcolumn variable a numeric column index? If it is, use mine. If it's a letter use Marcster's.

Cal

Djblois
02-13-2007, 12:43 PM
Thank you that worked