VBA & Macro Problems

How to Get Cell or Row Height in Excel Using Custom Functions

Anum MushtaqAnum Mushtaq Nov 3, 2026 869 views

Question details

The user wants to know how to return the row height of a specific cell using a worksheet function in Excel.

How to Get Cell or Row Height in Excel Using Custom Functions
Product
Excel
Device & OS
not provided
Scenario
Trying to calculate, display, or reference the exact height of a row or cell directly within a spreadsheet.
Observed behavior
Excel lacks a native built-in formula to directly return row height, requiring alternative methods like VBA or legacy functions.
Before you start

Before you begin, ensure you have enabled the Developer tab in your spreadsheet and are comfortable opening the VBA Editor, as you will need to create a custom macro function or use legacy name manager settings.

Solution 1Recommended

Create a VBA User-Defined Function (UDF)

Write a simple VBA script to create a custom formula that returns the height of any selected cell.

Because Excel does not have a native row height function, creating a User-Defined Function in VBA is the most reliable method. The 'Application.Volatile' command ensures the formula updates when the sheet recalculates.

1
Open the VBA Editor

Open your Excel workbook and press Alt + F11 to launch the Microsoft Visual Basic for Applications (VBA) editor.

2
Insert a New Module

In the top menu, click Insert > Module to create a new blank code module.

3
Enter the Custom Function Code

Copy and paste the following code into the module window: Function RowHeight(rng As Range) As Double Application.Volatile RowHeight = rng(1).RowHeight End Function

4
Use the Formula in Your Worksheet

Close the VBA editor. Go to any cell in your worksheet and type =RowHeight(A1) to return the height of cell A1.

Create a VBA User-Defined Function (UDF)
Recalculation Required: Changing a row height using the mouse does not automatically trigger an Excel calculation. You must manually press F9 on your keyboard to refresh the returned height values.
Seamless VBA Support in WPS

Create Custom Functions with WPS Spreadsheet

WPS Spreadsheet provides excellent support for VBA macros and User-Defined Functions, allowing you to easily create a custom row height formula just like in Excel. It is lightweight, fully compatible with Microsoft Excel formats (.xlsx, .xlsm), and free to use.

  1. 1. Open the VBA Editor: Open your workbook in WPS Spreadsheet, go to the Developer tab, and click on 'VBA Editor' or press Alt + F11.
  2. 2. Insert the VBA Code: Click Insert > Module, and paste the RowHeight VBA code into the code window.
  3. 3. Save as Macro-Enabled: Save your file as a Macro-Enabled Workbook (.xlsm) to ensure your custom function is preserved.
  4. 4. Use the Function: Type =RowHeight(A1) directly into any cell within your WPS Spreadsheet to extract the row height instantly.
Full support for VBA (Visual Basic for Applications) to automate tasks.Fully compatible with Microsoft Excel .xlsx and .xlsm formats.Free, lightweight, and fast-loading spreadsheet software.Familiar user interface requiring zero learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the cell height formula update automatically when I drag the row border?

Adjusting a row or column border with your mouse does not trigger Excel's calculation engine. Even with 'Application.Volatile' included in your VBA code, you must manually press F9 to force the worksheet to recalculate and display the new row height.

Is there a built-in formula to find cell height in Excel?

No, Excel does not have a standard built-in worksheet function like =ROWHEIGHT(). You must rely on custom VBA User-Defined Functions or the legacy Excel 4.0 GET.CELL macro function.

Can I use the cell height function on a multi-cell range?

Yes, but by default, the VBA function rng(1).RowHeight will only return the height of the very first top row within that selected multi-cell range.

Why am I getting an error when saving my workbook with GET.CELL?

The GET.CELL function is part of the legacy Excel 4.0 Macro system. To successfully save a workbook containing this function or any custom VBA code, you must save the file in the Macro-Enabled Workbook format (.xlsm).