Print Cell Height And Cell Width Of A Cell In Excel

In this post we will see how to get cell height and cell width value in a cell in excel.

We will use cell’s height and width properties in VBA to get the dimension of cell i.e. row and height.

Below is a cell and we are showing its height and width in terms of excel size in the cell




Excel showing row height and width are displayed in a cell

Step 1

Open VB editor from Develop the workbook in which we will write the code to get the dimension of the cell in terms of its weight and width

Open developer tab to write VBA to find cell dimension

Step 2

Insert a module in which we will the VBA code.

Insert a module in the VB editor

Step 3

Now double click the newly created module to open that and paste the below code in the module.




Sub Get_Range()

Dim r As Range

Set r = ActiveSheet.Range(“A1”)

Range(“A1”).Value = “Width= ” & r.Width & ” ” & “Height= ” & r.Height

End Sub

Code to get row's height and width of a cell

This code will leverage width and height properties of range class and write the value of cell’s height and width in cell A1.

You can loop through this program to get height and width of all the cells in a range.

Hope this helped.




Share The Knowledge

Random Posts