473,378 Members | 1,236 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 7031
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ImraneA | last post by:
Hi there Many thanks to those people who contributed to this group, helped me greatly. Enclose, my code, hope it helps others :- Public Function Export_Excel_9(tbx1 As Variant, tbx2 As...
0
by: ImraneA | last post by:
Hi there Have a database, where front-end interface allows user to select a ms access database. From there, standard tables are linked. Routine, that creates a spreadsheet, for each table a...
12
by: Ed | last post by:
Hi All, I'm looking for an efficient way of dumping a table in a Dataset into an Excel sheet. I'm currently copying data cell by cell and this is rather inefficient for large Datasets. My...
3
by: | last post by:
Hello, I have a routine in my Windows application that exports the contents of a datagrid to Excel. It is modeled closely after the HowTo example on MSDN: http://tinyurl.com/5g2jm. Depending...
3
by: | last post by:
I wrote a class in VB.NET to export the contents of a datagrid to Excel. It works perfectly on my machine, but it fails on my customers' PCs that have identical versions of Win XP (SP1) and Excel...
0
by: keithsimpson3973 | last post by:
I have the following code to populate an excel spreadsheet from vb6 and access database. It works great except that when it reads from the recordset and populates the spreadsheet, I would like it to...
3
by: Ray | last post by:
Hi, I'm working on something with mysql and excel. I'm using python and win32com. All major function works, But I have two problems: 1. the output need to do "auto fit" to make it readable. ...
0
by: AlexNunley | last post by:
I am trying to dump data from an access query into excel so I can pretify it. I found sample code from an old access 97 book (The version of access in use)and tinkered it into working. Well sort...
1
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.