# How To Display Row Height Or Column Width In Cells?

In order to efficiently organise and present data in Microsoft Excel, row heights and column widths are quite important. For a variety of reasons, such as altering formatting, aligning content, or examining data patterns, you may frequently need to know the precise dimensions of rows or columns. Although Excel offers default measures, it can be difficult to properly visualise these dimensions.

Fortunately, you can automate processes and increase your control over your worksheets thanks to Excel's robust programming language, Visual Basic for Applications (VBA). In this lesson, we'll look at how to display row heights or column widths within the actual cells using VBA code. Your productivity can be greatly increased by using this method, which also makes it simpler to use Excel's formatting tools.

## Display Row Height Or Column Width In Cells

Here, we will first create a defined formula and use the formula to complete the task. So let us see a simple process to know how you can display row height or column width in cells in Excel.

### Step 1

Consider any Excel sheet. First, rightâˆ’click on the sheet name and select View Code to open a VBA application. Then, click on "Insert" and select "Module.

Right click > View code > Insert > Module.

### Step 2

Then copy the below code into the textbox, similar to the below image.

### Code

Function RowHeight(MR As Range) As Double
Application.Volatile
RowHeight = MR.RowHeight
End Function


### Step 3

Then click on an empty cell, enter the formula as =RowHeight(A1) and drag using the autofill handle.

Empty cell > Formula > Enter.

Note âˆ’

If you want to display the column width, use the below code and use the formula as =ColumnWidth(A1) then drag.

### Code

Function ColumnWidth(MR As Range) As Double
Application.Volatile
ColumnWidth = MR.ColumnWidth
End Function


## Conclusion

In this tutorial, we have used a simple example to demonstrate how you can display row height or column width in cells in Excel to highlight a particular set of data.

Updated on: 12-Jul-2023

2K+ Views