excel column autofit

Jeff Peck jpeck at fedex.com
Wed Jun 13 01:28:51 CEST 2007


Lance Hoffmeyer wrote:
> Hey all,
>
> Wondering why the syntax won't autofit Column A?
> I am not getting any errors.
>
> Also, is there a way of reducing the number of
> syntax lines?  Basically, I am wondering if there
> is an easier way to copy and paste?
>
> Thanks in Advance.
>
> Lance
>
> # ADD ROW LABELS
> sh = wb.Worksheets ("Total")
> sh.Select()
> sh.Range(sh.Cells(2,1),  sh.Cells(20,1)).Select()
> sh.Range(sh.Cells(2,1),  sh.Cells(20,1)).Copy()
> sh = wb.Worksheets ("Current Total")
> sh.Select()
> sh.Range(sh.Cells(2,1),sh.Cells(20,1)).Select()
> sh.Paste()
> sh.Columns("A:A").EntireColumn.AutoFit
>   
Looks like you just forgot to add the parenthesis after AutoFit

sh.Columns("A:A").EntireColumn.AutoFit()


Jeff




More information about the Python-list mailing list