ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Increase columns with interop (https://www.excelbanter.com/excel-programming/366410-increase-columns-interop.html)

Tim Lypes

Increase columns with interop
 
Hello,
I write an VB 2005 application that fills data into an excel spreadsheet
with office.interop.
Now I wanted to ask if it is possible to increase the column width to the
highest text value. Maybe you know that effect if you double click the line
between two excel columns and the width increase automatically.

Can anybody help to find the right function?



NickHK

Increase columns with interop
 
Tim,
Look at the .Autofit property.
Columns("A:A").EntireColumn.AutoFit

It's easy to record a macro in Excel then translate the code. To VB.Net in
your case.

NickHK

"Tim Lypes" wrote in message
...
Hello,
I write an VB 2005 application that fills data into an excel spreadsheet
with office.interop.
Now I wanted to ask if it is possible to increase the column width to the
highest text value. Maybe you know that effect if you double click the

line
between two excel columns and the width increase automatically.

Can anybody help to find the right function?





Tim Lypes

Increase columns with interop
 
Nick,

great! Thank you




All times are GMT +1. The time now is 03:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com