Excel Guides

Setting Row Height in a Macro in Excel

When working with macros in Excel, you may need to set the row height in order to ensure that all of your data is visible. This can be done by using the RowHeight property of the Range object. The RowHeight property takes a value in points, so you will need to convert your desired row height into points. For example, if you want your row height to be 1 inch, you would need to set the RowHeight property to 72 points.

In order to set the row height for a range of cells, you can use the SetRowHeight method. This method takes two arguments: the first is the row index of the first row in the range, and the second is the row height in points. For example, if you wanted to set the row height for rows 1-5 to 1 inch, you would use the following code:

Range("A1:E5").SetRowHeight 72

You can also set the row height for an entire sheet by using the Sheet.StandardHeight property. This property takes a value in points, so again, you will need to convert your desired row height into points. For example, if you want your sheet's default row height to be 1 inch, you would use the following code:

ActiveSheet.StandardHeight = 72

Move beyond 

Excel

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.