By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,510 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,510 IT Pros & Developers. It's quick & easy.

Column autofit with VBA for a table

P: 11
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, 354 views)
Mar 7 '14 #1
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,186
How about the .AutoFit method?
Mar 8 '14 #2

Post your reply

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