M
Michiel via OfficeKB.com
Anyone,
I have written a sub that does the following:
1) Add a new sheet to a workbook
2) Import a textfile into that worksheet
3) Performs an autofit to the columns with the imported data (Columns.
EntireColumn.AutoFit)
The last step does not seem to work. The line is executed but the column
width does not change.
If I run through it in debug mode and perform the Columns.EntireColumn.
AutoFit command in the Immediate window nothing happens either.
If I allow the code to finish (the "Columns.EntireColumn.AutoFit" was the
last command in that sub) and then appy the Columns.EntireColumn.AutoFit in
the Immediate window it works perfectly.
I checked the application.screenupdating parameter. It is TRUE. I also tried
adding a DoEventscommand after the Columns.EntireColumn.AutoFit but nothing
works.
What can be happening here? And how do I force Excel to compy to my commands?
M.
I have written a sub that does the following:
1) Add a new sheet to a workbook
2) Import a textfile into that worksheet
3) Performs an autofit to the columns with the imported data (Columns.
EntireColumn.AutoFit)
The last step does not seem to work. The line is executed but the column
width does not change.
If I run through it in debug mode and perform the Columns.EntireColumn.
AutoFit command in the Immediate window nothing happens either.
If I allow the code to finish (the "Columns.EntireColumn.AutoFit" was the
last command in that sub) and then appy the Columns.EntireColumn.AutoFit in
the Immediate window it works perfectly.
I checked the application.screenupdating parameter. It is TRUE. I also tried
adding a DoEventscommand after the Columns.EntireColumn.AutoFit but nothing
works.
What can be happening here? And how do I force Excel to compy to my commands?
M.