This would be done for each sheet:
set sh = Sheets("Claims")
' To fit the first 10 columns as an example
for column=1 to 10
sh.columns(column).AutoFit
next
Main Topics
Browse All TopicsHi guys
I'm programming in Access, and exporting various datasets to Excel tabs.
When I open the Excel spreadsheet, all column widths are the same size, which cuts off data.
Question: What's the Excel VBA code to auto-adjust all columns based on the values in them?
My post-Excel creation code snipped is attached.
Thanks in advance.
Jim
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Used a combination of both. Sheets did not ahve a column property/collection, Worksheets did.
Thanks.
Jim
Dim xl As Excel.Application, wb As Excel.Workbook, sh As Excel.Worksheet
Set xl = New Excel.Application
Set wb = xl.Workbooks.Open(strOutpu
Set sh = wb.Worksheets(1)
sh.Columns.EntireColumn.Au
sh.name = "Claims"
Set sh = wb.Worksheets(2)
sh.Columns.EntireColumn.Au
sh.name = "Commissions"
Set sh = wb.Worksheets(3)
sh.Columns.EntireColumn.Au
sh.name = "Refunds"
wb.Save
wb.Close True
Set sh = Nothing
Set wb = Nothing
Set xl = Nothing
Business Accounts
Answer for Membership
by: CSLARSENPosted on 2009-07-06 at 09:29:59ID: 24786785
Hi
A:F").Enti reColumn.A utoFit
I guess you need something like this.
Sheets("Claims").Columns("
Cheers
cslarsen