File Exchange

image thumbnail

Set columns in Excel to Auto Fit

version (1.33 KB) by Tal Shir
Set columns in Excel to Auto Fit


Updated 12 Mar 2009

View License

This function will set the selected columns to autofit.
This is the same as using the Excel menu: Format -> Column -> AutoFit Selection .
Example :xlsAutoFitCol('filename','Sheet1','A:F')

Cite As

Tal Shir (2021). Set columns in Excel to Auto Fit (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Monika Jaskolka

I find that there is weird behaviour when there is a newline, like char(10), in the cell. Sometimes the autofit is too small.

Muhammed Al-barham

Carsten Ridder

Monika Jaskolka

Works in 2016a.


Exactly what I was looking for :-)

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!