Select the cells and click Autosize (Ctrl+Shift+Z) in the Arrange menu or the Autosize button in the Format PanelĀ (Ctrl+Shift+P):

autosize.png