Here are 2 ways to adjust your cell size so that your contents fits into them.
1) Using Excel Formating Tool
If you want to autofit a row, select the row with the content, then goto Format > Row > AutoFit
If it’s a column that you want to fit, select the whole column and goto Format > Row > AutoFit
2) Using Excel VBA Macro
Programming wise, this is how you do it:
To autofit the D column
ActiveSheet.Columns("D").AutoFit or ActiveSheet.Range("D:D").Columns.AutoFit
Change the Columnsand D to Rows and the appropriate “row index” to autofit a row instead.
Short and simple 🙂