# Change Row Height in VBA (With Examples)

You can use the following methods to change the row height in Excel using VBA:

Method 1: Change Height of One Row

```Sub ChangeRowHeight()
Rows(3).RowHeight = 40
End Sub
```

This particular macro changes the height of the third row to 40.

Note: The default row height in Excel is 14.4.

Method 2: Change Height of Multiple Rows

```Sub ChangeRowHeight()
Rows("1:5").RowHeight = 40
End Sub
```

This particular macro changes the height of each row from one through five to 40.

Method 3: Auto Adjust Height of Multiple Rows

```Sub ChangeRowHeight()
Rows("1:8").AutoFit
End Sub```

This particular macro automatically adjusts the height of each row from one through eight to be as tall as necessary to display the tallest text in each row.

The following examples show how to use each of these methods in practice with the following dataset in Excel: Related:

## Example 1: Change Height of One Row

We can create the following macro to change the height of the third row to 40:

```Sub ChangeRowHeight()
Rows(3).RowHeight = 40
End Sub``` Notice that only the height of the third row has been increased to 40 while the height of all other rows remained the same.

## Example 2: Change Height of Multiple Rows

We can create the following macro to change the height of each row from one through five to 40:

```Sub ChangeRowHeight()
Rows("1:5").RowHeight = 40
End Sub```

When we run this macro, we receive the following output: Notice that the height of each of the first five rows has increased to 40 while the height of all other rows remained the same.

## Example 3: Auto Adjust Height of Multiple Rows

We can create the following macro to automatically adjust the height of each of the first eight rows to be as tall as necessary to display the tallest text in each row:

```Sub ChangeRowHeight()
Rows("1:8").AutoFit
End Sub```

When we run this macro, we receive the following output: Notice that the height of each row has automatically been adjusted to be as tall as necessary to display the tallest text in each row: