Position the mouse pointer on the right edge of the column header or the bottom edge of the row header.
When the mouse pointer changes to a double-headed arrow, double-click the mouse.
You can also click the Home tab,
click the Format button,
and then click AutoFit Column Width or AutoFit Row Height.