From: mully Date: 2006-12-13T21:45:06+09:00 Subject: Re: Directory Size and bolding Excel cells anon1m0us@yahoo.com wrote: > Ok, I got the cells to autofit using the below code. "#{loc} is a > variable for my worksheets. > > excel.Worksheets("#{loc}").Columns("A:A").AutoFit > excel.Worksheets("#{loc}").Columns("B:B").AutoFit > excel.Worksheets("#{loc}").Columns("C:C").AutoFit > excel.Worksheets("#{loc}").Columns("D:D").AutoFit > excel.Worksheets("#{loc}").Columns("E:E").AutoFit > FYI, the Columns method can accept a range of columns, so you could replace the above five lines of code with a single line... excel.Worksheets("#{loc}").Columns("A:E").AutoFit Or, to address all columns in a worksheet... excel.Worksheets("#{loc}").Columns.AutoFit Mully