473,320 Members | 2,117 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,320 software developers and data experts.

Column autofit with VBA for a table

Hi,

I recently put together an access db that spits out a tons of separate Excel sheets by looping through a querydef. The select items are dynamic (different columns can be added or removed with checkboxes) and I have an issue with doing a column autofit on the table. when i got to adjust the columnwidth to the range, it decides to fit once for the content and then a second time for the headers. Based on the data, the columns are often cut off. I cant use the entire column function because there is header information (again populated from Access) that is longer. Is there a way to apply a column width for an entire range of cells taking the widest cell into account? You can see what I am talking about in the "alloc amount" and "award type" columns in the attachment.
Attached Images
File Type: jpg sampleofexcel.jpg (107.1 KB, 543 views)
Mar 7 '14 #1
1 3246
NeoPa
32,556 Expert Mod 16PB
How about the .AutoFit method?
Mar 8 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Don Grover | last post by:
I have a HTML table created using ASP as a web page. ie. HEADING1 HEADING2 HEADING3 etc... data 1 data2 data3 etc and so on How can I toggle hide /...
5
by: news.swissonline.ch | last post by:
Hi, DB2 7 FP 13 Windows XP I have a table in which on of the columns has the data type DATE. The date column is indexed (asc non-unique index). Every SQL I create which tries to filter by...
3
by: alex | last post by:
Hi, is there an easy way to 1: make the column witdh to fit the text 2: to fit the table into the grid if it is smaller e.g. to add some space space to each column to fit it nicely into the...
1
by: grime | last post by:
Thanks in advance for the help... should be an easy one for you all. I have a access table where I have the following fields: Product Sales I want to add a 3rd column (AdjustedSales) where if...
6
by: Christopher Lusardi | last post by:
How can I fix this? When I do the below I get the error message: "Cannot insert explict value for identity column in table 'Employees' when IDENTITY_INSERT is set to OFF." To get this message,...
5
by: Hokiecow | last post by:
I'm trying to import specific columns from an excel file (Requirements.xls) into an access table (tblRequirements). Using VBA, I'm able to import the entire excel file into table...
2
by: Lance Hoffmeyer | last post by:
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...
16
by: vamsioracle | last post by:
Can Someone help me how to avoid mutating error while using triggers. I work on oracle apps. I created a vacation rule such that responsibility is delegated to other person. These details are...
6
by: Chandan Kr Sah | last post by:
How to drop primary key constraint from a column of table ? Actually I got so many example for this, but in that we require the primary key name also. But I dont have the primary key name.So if I...
2
by: smsintel | last post by:
hi plzz tell me query last modifications in column in table oracle 10g
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.