In Excel, AutoFit feature is used to resize row height and cell width based on the size of the value in the cells.
As you know, Excel has default rows height and cells width and when the user enters any value whose length is more than the cell width, the value spills over the cells, and to resize the cells based on that value we can use AutoFit.
In the below image you can see the length of the values entered was more than the default size of the cells due to which the values spilled over the cells.
Keyboard Shortcut to Use AutoFit in the Excel
AutoFit Cells Width (Columns): Alt → H → O → I
AutoFit Row Height (Rows): Alt → H → O → A
Steps to use AutoFit Cells Width Using Keyboard Shortcut
- First, select the single cell or the whole column using the “Ctrl + Spacebar” keys.
- Now, simply press “Alt → H → O → I” and the width of your cells will get expand based on the top largest cell value within the column.
Steps to use AutoFit Row height Using Keyboard Shortcut
Let’s assume you have unstructured data where in a column you have some values in wrap text and some are not due to which the row height of the data is not same and to make rows and column AutoFit, follow the below steps:
- First, select the column and expand the column width manually to a level where all the values can be covered.
- After that, simply press “Alt → H → O → A” and you will get the rows’ height adjusted.
Note: In the above case if you use AutoFit cells shortcut to AutoFit the width of the cell, it will not work properly because AutoFit does not work on wrapped text cells and there might be a possibility of having more larger value in any wrapped text cell, so it is advised to expand the column manually and then use the AutoFit row height shortcut.