How to Auto Fit Row Height in Excel (5 Useful Ways)

Get FREE Advanced Excel Exercises with Solutions!

Autofitting row height in Excel means the automatic adjustment of a row’s height to fit the content within its cells. It simplifies the process, eliminates the need for manual adjustments, and enhances the overall readability of the spreadsheet.

In this Excel tutorial, you’ll learn how to adjust row height automatically in Excel using Excel features, keyboard shortcut, and VBA.

Consider a dataset where some rows have excessively large row heights, while others have very small row heights, making it disorganized and difficult to view the contents clearly. To address this issue, we have adjusted the row heights to organize the date and ensure proper visibility of the content.

How to Autofit Row Height in Excel

What is Row Height in Excel?

Row height in Excel defines the vertical measurement of a row in a spreadsheet. You can check the height of a specific row by clicking on the boundary below the row bar and holding the mouse button. This will display the row height in points and pixels.

In Excel, the default row height is set at 12.75 points with the Calibri 11 font, which is equivalent to approximately 1/6 inch or 0.4 cm. However, versions like Excel 2019, 2016, and Excel 2013 may show variations in row height due to display scaling (DPI), ranging from 15 points at 100% DPI to 14.3 points at 200% DPI.

Due to display scaling, font type, and length of cell content, we often need to adjust the row height to accommodate diverse content within cells to ensure that all information in the row is visible. Users can manually set row heights within the range of 0 to 409 points, with each point approximately equal to 1/72 inch or 0.035 cm. Notably, a hidden row has a height of zero (0) point.


5 Ways to Auto Adjust Row Height in Excel

If you want to reduce or increase Excel row heights, there are several ways to adjust them. Here are 5 ways to automatically adjust row height in Excel:

Using Excel AutoFit Row Height Feature

The AutoFit Row Height feature in Excel automatically adjusts the row height to accommodate the tallest content within the row.

To adjust row height automatically using the AutoFit Row Height feature, follow the steps below:

  1. Select the row or rows whose height you want to change.
  2. Go to the Home tab > Cells group > Format drop-down > AutoFit Row Height.
    Excel AutoFit Row Height Feature to Auto Adjust Row Height

As a result, the height of the selected rows will automatically adjust.

Applying Keyboard Shortcut

The keyboard shortcut minimizes the need for manual clicks, offering a convenient and time-saving method to ensure optimal visibility of content within rows. Those who prefer working with the keyboard most of the time may find this method quite useful.

To apply the keyboard shortcut to autofit row height, follow the steps below:

  1. Select the row or rows whose height you want to change.
    Auto-Adjust Row Height in Excel With Keyboard Shortcut
  2. Next, press the keys ‘Alt’, ‘H’, ‘O’ and ‘A’ one after another.

Consequently, the height of the selected rows will adjust automatically.

Double-clicking With Mouse

Autofitting row height with a mouse in Excel is the quickest and simplest method. A quick double-click on the row bar adjusts the height automatically to fit the content.

Follow the steps below to auto fit row height in Excel using the mouse:

  1. Select the row or rows whose height you want to change.
  2. Hover the mouse pointer over the lower boundary of the row heading.
  3. Double-click on the border.

This will adjust the height of the selected rows based on the size of the cell content.

Read More: How to Adjust Row Height to Fit Text in Excel

Applying Excel Wrap Text Feature

The Wrap Text feature in Excel splits text into multiple lines within a cell. It automatically adjusts the row height to fit the content within the column width.

Excel Wrap Text Feature to Adjust Row Height

Follow the steps below to auto fit row height in Excel using the Wrap Text feature:

  1. Select the cells that you want to wrap.
  2. Go to Home tab > Alignment group > Wrap Text.

This will wrap the text of the selected cells and adjust the row height of the selected cells automatically.

Read More: How to Change Row Height in Excel

Using Excel VBA Code

Using VBA code for autofitting row height in Excel is particularly advantageous when dealing with bulk operations, dynamic content changes, or the need for custom logic. It provides a smooth and automated approach for efficient and consistent row height adjustments.

To autofit row height using Excel VBA code, follow the steps below:

  1. Go to Developer tab > Code group > Visual Basic. Or, press the Alt+F11 keys.
    Using VBA CodeAs a result, the VBA window will appear.
  2. Click on the Insert tab and choose the Module option to insert a module.
    Inserting Module
  3. Enter the following code in a module:
    Sub Autofit_Row_Height()
        Dim selectedRows As Range
    
        Set selectedRows = Application.InputBox("Select the range of rows to autofit:", Type:=8)
    
        If Not selectedRows Is Nothing Then
            selectedRows.WrapText = True
            selectedRows.EntireRow.AutoFit
        Else
            MsgBox "Invalid selection. Please select a valid range of rows."
        End If
    End Sub
  4. Click the Run button.
    Running VBA CodeAs a result, an input box will appear and ask you to select the range of rows that you want to autofit.
  5. Select the range of rows that you want to autofit and click OK.
    Selecting Rows

As a result, the rows in the selected range will autofit.

Autofit Row Height


How to Set a Constant Row Height in Excel

The Row Height feature in Excel allows users to set a consistent and predetermined height for rows. This ensures uniformity and facilitates a more organized and visually appealing presentation of data within the spreadsheet.

Follow the steps below to set a constant row height:

  1. Select the rows for which you want to set the constant row height.
  2. Go to Home tab > Cells > Format > Row Height.
    Excel Row Height Feature for Adjusting Row HeightAs a result, the Row Height dialogue box will pop out.
  3. Enter the desired row height in pixels and click OK.

As a result, all the selected rows will be in their newly adjusted height.

Read More: How to Change & Restore Default Row Height in Excel


Why Excel AutoFit is Not Functioning?

The possible reasons for Excel AutoFit feature is not working are:

  • If you have Merged Cells, the AutoFit feature won’t work. You have to manually set the row height for such cases.
  • The AutoFit feature also won’t work if you have applied the Wrap Text feature in your cells. You have to manually set the row height for such cases.

Download Practice Workbook

Download the following workbook to practice by yourself.


Conclusion

Autofitting row height in Excel automates the adjustment of a row’s height to fit the content within its cells, which simplifies the process, eliminates the need for manual adjustments, and enhances the overall readability of the spreadsheet. This article provides five different methods for auto adjusting row height in Excel, including using the AutoFit Row Height feature, applying a keyboard shortcut, double-clicking with the mouse, using the Wrap Text feature, and utilizing Excel VBA code. If you have any questions or suggestions regarding this, please feel free to ask in the comment section below or on our forum. Thank you!


Frequently Asked Questions

How do I autofit row height in Excel for Mac?

  1. Select the rows for resizing.
  2. Press Command+A to select the entire sheet or hold Command and select the rows you need to adjust.
  3. Press Fn+Control+F2 to quickly autofit the selected rows.

How to autofit row height for the entire sheet?

Press Ctrl+A (Windows) or Command+A (Mac) or click the Select All button. Next, either double-click the boundary between any two-row headings or navigate to Home > Cells > Format > AutoFit Row Height on the ribbon.

How do you autofit text in columns?

Double-click on the right boundary of the column heading or go to Home > Cells > Format > AutoFit Column Width to adjust the column width based on the content.


Related Articles


<< Go Back to Row Height | Rows in Excel | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Aung Shine
Aung Shine

Aung Shine completed his bachelor’s in Electrical and Electronics Engineering from Bangladesh University of Engineering and Technology. It has been almost 2 years since he joined SOFTEKO and actively working on the ExcelDemy project. Currently he works as a Team Leader where he guides his team members to create technical content. He has published 150+ articles and reviewed 50+ articles. He has also solved various user problems before. He has interests in Data Analysis, Power Query, Advanced Excel,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo