471,330 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

excel column autofit

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
Jun 12 '07 #1
2 6877
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

Jun 13 '07 #2
On Jun 13, 8:09 am, Lance Hoffmeyer <l...@augustmail.comwrote:
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
You need () after Autifit.
You need to look up "syntax" in a dictionary.

HTH,
John

Jun 13 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by | last post: by
3 posts views Thread by Ray | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.