I need to automate the import of .txt file and set column widths to specific criteria. I know that it's possible for doing this with data that is delimited, but i've yet to find a source for fixed width. Any suggestions?
Asked
Active
Viewed 894 times
1 Answers
0
I found this article that lays it out.
Change Row Height and Column Width using Excel VBA - by Valli ยท May 18, 2013
Just figure out what the actual width needs to be and you should be good to go.
These code samples were taken from the article to save you some time.
Sub sbChangeColumnWidth()
Columns("B").ColumnWidth = 25
End Sub
Sub sbChangeColumnWidthMulti()
Columns("B:E").ColumnWidth = 25
End Sub
There is also .Columns.AutoFit
There are some more resources about How column widths are determinied in Excel:
EDIT: Added links at bottom

peege
- 2,467
- 1
- 10
- 24