Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel column autofit?

Status
Not open for further replies.

dBjason

Programmer
Joined
Mar 25, 2005
Messages
355
Location
US
Trying to automate a worksheet, would like to know how to autofit column width (like when you double-click inbetween columns) in VBA. Anybody know?
 
dbjason

Columns("D:D").EntireColumn.AutoFit

Bes tway to find things like this is to use the macro recorder to record you doing it then have a look at the code that is generated.


 
Note that AutoFit won't work on merged cells. If this issue is important to you, a much more sophisticated macro is required.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top