ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Resize an Excel Column from VB (https://www.excelbanter.com/excel-programming/335708-resize-excel-column-vbulletin.html)

[email protected]

Resize an Excel Column from VB
 
Hi,


I'm using Office XP and I'm trying to use VB (from Access) to resize a
columns in Excel based on the text (size to fit). How can I do this?


Thanks in advance.


Nick Hebb

Resize an Excel Column from VB
 
Dim ws As Excel.Worksheet

Set ws = oXLApp.Worksheets("Your worksheet name")
ws.Columns("A:A").EntireColumn.AutoFit


This assumes that you have some reference to the application, which is
oXLApp in this sample code.



All times are GMT +1. The time now is 01:31 PM.

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