AutoFit Row Height In Excel

What Is Excel AutoFit Row Height?

AutoFit Row Height in Excel is an option that helps one adjust the row height to fit the cell content completely. And since the feature automatically resizes row height, we do not have to cite the row height manually.

Users can use the AutoFit Row Height in Excel option to make massive datasets more presentable, readable, and error-free.

For example, the following image shows a dataset listing the top ten best sellers in 2023.

AutoFit Row Height in Excel - Definition Example - 1

However, the data is unclear since the row height is smaller for the cell content in the range A1:A11.

Though we can utilize the AutoFit Row Height in Excel VBA option, the simpler way is to use the AutoFit Row Height option from the ribbon.

AutoFit Row Height in Excel - Definition Example - 2

In the above example, we can select the cell range A1:A11. Otherwise, we can choose the range A1:A11 and press Shift + Space to select the entire 1 to 11 rows. Next, choose the AutoFit Row Height option under the Format command in the Home tab.

The chosen cells’ row height will be resized automatically according to each cell’s content, ensuring the data in all the cells in the chosen range is completely visible.

Key Takeaways
  • The AutoFit Row Height in Excel option helps to auto-adjust the row height of one or more rows in a worksheet.
  • Users can use the AutoFit Row Height Excel option to ensure data in all the cells in chosen rows are visible and more presentable.
  • We can use the AutoFit Row Height option in the Home tab and Excel VBA coding to auto-adjust the required rows’ height.
  • We can use the mouse cursor to manually autofit the row height of the chosen rows in a worksheet.

How To Change Default Row Height?

The steps to change the default row height are as follows:

  1. Hover the cursor on the bottom border of the row number, where the row contains the cell for which the aim is to change the default row height.
  2. The cursor will appear as a Row Resize mouse pointer, which is a plus sign with the vertical line being double-arrowed.
  3. While pressing the mouse’s left key, drag the cursor down or up to increase or decrease the specific row height. Also, once we press the mouse’s left key, the row height in points and pixels will show above the cursor in a box. And when we drag the cursor, the row height value keeps changing, which helps us set the desired height of the specific row.

Furthermore, consider that we must change the default row height of multiple cells, whether in contiguous or non-contiguous rows. Then, we must select the specific rows and hover the mouse cursor on the bottom Excel border of any row in the selection. After that, we can use the abovementioned steps to change the rows’ default height and set the same row height for all the chosen rows.

On the other hand, hovering the mouse cursor on the top border of the specific row number will lead to AutoFit Row Height in Excel not working.

AutoFit Row Height In Excel

While AutoFit Row Height in Excel VBA is possible, we will see more straightforward methods to autofit the row height in a worksheet.

Method #1 – Using AutoFit Row Height Option From Excel Ribbon

The steps to autofit row height in Excel using the AutoFit Row Height option in the Excel ribbon are as follows:

  1. Choose the required row or rows containing the cells for which the aim is to Excel autofit the row height.
  2. Select the Home tab → Format option drop-down → AutoFit Row Height option. [ Alternatively, we can use Alt + O + R + A as the shortcut to AutoFit Row Height in Excel.]

The chosen row’s or rows’ row height will get autofitted.

Method #2 – Using Manual Method

The steps to autofit row height in Excelusing the manual method are as follows:

  1. Hover the mouse cursor on the bottom border of the concerned row number, where the row contains the cell or cells for which the aim is to autofit the row height.
  2. The cursor will appear as a Row Resize mouse pointer.
  3. Double-click the mouse to auto-adjust the row height according to the row content or font size.

However, consider that we must autofit the row height of multiple cells, whether in contiguous or non-contiguous rows. Then, we must choose the specific rows and hover the mouse cursor on the bottom border of any row in the selection. After that, we can use the abovementioned steps to autofit the rows’ height according to the rows’ content.

Please note that if the chosen rows have cells containing data in different font sizes. Then, the row height will autofit according to the data with the biggest font size in the specific row.

On the other hand, hovering the mouse cursor on the top border of the specific row number will lead to AutoFit Row Height in Excel not working.

Examples

We shall see the examples of the AutoFit Row Height option in Excel to use it effectively.

Example #1

The following example explains how to change the default row height in Excel.

The image below shows a dataset.

AutoFit Row Height in Excel - Example 1

Currently, each row’s height in the dataset is 14.5 points, the default row height. Here is how to change the default row height of one or multiple rows to 20 points.

  • Step 1: Click the row number 1 to choose the entire row.
Example 1 - Step 1
  • Step 2: Hover the cursor over the row number 1 bottom border to get the Row Resize mouse pointer and view the current row height points.
Example 1 - Step 2
  • Step 3: While pressing the mouse’s left key, drag the cursor down to move the specific row’s bottom border downwards till the row height is 20 points.
Example 1 - Step 3

Next, release the mouse’s left key to view the selected row with the changed row height.

AutoFit Row Height in Excel - Example 1 - Step 3b

Furthermore, consider we must change the default row height of all the rows in the dataset to 20 points. Then, the steps are as follows:

  • Step 1: Select row number 1 to choose the entire row. Next, while pressing the mouse’s left key, drag the mouse cursor to row number 11 to select rows 1 to 11.
Example 1-1- Step 1
  • Step 2: Hover the cursor over the row number 11 bottom border to get the Row Resize mouse pointer and view the current row height points.
Example 1-1- Step 2
  • Step 3: While pressing the mouse’s left key, drag the cursor down to move all the rows’ bottom borders downwards till the row height is 20 points.
Example 1-1- Step 3a

Next, release the mouse’s left key to view all the rows with their row heights changed to 20 points.

AutoFit Row Height in Excel - Example 1-1- Step 3b

[ Alternatively, we can use the following method to change the row height of multiple rows to the same points or pixels.

For example, consider the requirement to change the row height of rows 2 to 11 in the source dataset to 20 points.

  • Step 1: Click the first row number in the concerned set of rows to select the entire row.
Example 1-2- Step 1
  • Step 2: Place the cursor on the bottom border of the chosen row number to get the Row Resize mouse pointer and view the current row height.
Example 1-2- Step 2
  • Step 3: While pressing the mouse’s left key, drag the cursor downwards to move the specific row’s bottom border until the row height is 20 points.
Example 1-2- Step 3a

And once we release the mouse’s left key, row 2 appears with the changed row height.

Example 1-2- Step 3b
  • Step 4: Click the row number 2 to choose the entire row and select the Format Painter option in the Home tab.
 Example 1-2- Step 4
  • Step 5: While pressing the mouse’s left key, drag the mouse cursor, which will appear like a paintbrush icon, from row number 3 to row number 11.
Example 1-2- Step 5a

Finally, release the mouse’s left key to view rows 2 to 11 with the row height changed to the same points, 20.

AutoFit Row Height in Excel - Example 1-2- Step 5b

Example #2

The following table contains a dataset with data in different font sizes.

Excel AutoFit Row Height - Example 2

However, the row height of each row in the dataset must be autofitted.

So, here is how to auto-adjust the row height of each row in the source dataset to ensure the data is visible in all the cells and the dataset appears more presentable.

  • Step 1: Click the row number 1 to select the entire row. Next, while pressing the mouse’s left key, drag the mouse cursor to row number 11 to choose all the rows in the source dataset.

After that, choose Home Format AutoFit Row Height.

Example 2 - Step 1a

Once we choose the highlighted option, the chosen rows’ height gets autofitted according to the data in different font sizes. For example, the row height of row 1 is different from that of row 2 since the font size of the data in the two rows differs.

Example 2 - Step 1b

[Alternatively, we can choose the required rows in the source dataset and use Alt + O + R + A as the shortcut to AutoFit Row Height in Excel.]

Otherwise, as explained earlier, we can select all the rows in the given dataset.

Example 2 - Step 1c

Next, place the cursor on the bottom border of a row number, say row 11, to view the Row Resize mouse pointer and the row height of the chosen rows.

Example 2 - Step 1d

Finally, double-click to auto-adjust the row height of the chosen rows according to the data’s different font sizes.

Excel AutoFit Row Height - Example 2 - Step 1e

Important Things To Note

  • The AutoFit Row Height in Exceloption auto-adjusts the row height based on the cell data with the biggest font size in a specific row.
  • The AutoFit Row Height option in Excel may not work if the active sheet contains merged cells or Excel Wrap Text option enabled in the concerned row. However, we can use Excel VBA code to autofit the row height of merged cells manually.

Frequently Asked Questions (FAQs)

1. How to autofit row height in Excel using VBA?

We can autofit row height in Excel using VBA in the following way, explained with an example.

The following image shows a dataset.

Excel AutoFit Row Height - FAQ 1

Here is how to autofit row height in the given dataset using Excel VBA.

• Step 1: With the worksheet containing the source dataset open, press Alt + F11 to open the VBA Editor.

FAQ 1 - Step 1

• Step 2: Choose the required VBAProject and select the Module in the Insert tab to open a new module.

FAQ 1 - Step 2a

FAQ 1 - Step 2b

• Step 3: Type the VBA code in the module to autofit row height in the active worksheet.

Excel AutoFit Row Height - FAQ 1 - Step 3

• Step 4: Choose the play icon to run the VBA code.

FAQ 1 - Step 4a

Finally, open the active worksheet to view the rows with the row height autofitted.

Excel AutoFit Row Height - FAQ 1 - Step 4b

2. How to autofit row height of merged cells in Excel?

We can autofit row height of merged cells in Excel using the following steps:

Consider the active sheet contains data in merged cells, B2:C4, D7:F8, and H1:H3. Then, we can use Excel VBA to autofit the row height of merged cells, as explained below:

1) Open the worksheet containing the merged cells and press Alt + F11 to open the VBA Editor.
2) Choose the applicable VBAProject and select Module under Insert in the menu to open a new module.
3) Enter the following VBA code in the module to autofit the row height of the specified merged cells.

Excel AutoFit Row Height - FAQ 2

4) Press F5 to run the code.
5) Finally, open the active sheet to view the merged cells with the row height autofitted.

2. How is Row Height different from AutoFit Row Height?

Row Height is different from AutoFit Row Height based on how it enables us to adjust the row height of one or more rows.

The Row Height option helps us manually set the required row height for the chosen rows. On the other hand, the AutoFit Row Height option helps automatically adjust the row height based on the cell’s content or font size.

Download Template

This article must be helpful to understand the AutoFit Row Height In Excel, with its formula and examples. You can download the template here to use it instantly.

This has been a guide to What Is AutoFit Row Height In Excel. We learn how to change the default row height and autofit row height, with examples. You can learn more from the following articles –

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *