This feature is known as Excel AutoFit and further on in this tutorial you will learn 3 different ways to use it. The easiest way to resize cells is to have Excel automatically determine how much to widen or narrow the column and to expand or collapse the row to match the data size.
Microsoft Excel provides a handful of different ways to change column width and adjust row height.
In this tutorial, you will learn full details about Excel AutoFit and the most efficient ways to use it in your worksheets.