Skip to content

Instantly share code, notes, and snippets.

@ship9599
Last active December 11, 2017 17:39
Show Gist options
  • Save ship9599/3ed16a5bec24613998d380b3dd933d69 to your computer and use it in GitHub Desktop.
Save ship9599/3ed16a5bec24613998d380b3dd933d69 to your computer and use it in GitHub Desktop.
We can change row height in Excel using RowHeight Property of a Row in VBA. See the following example to do it.
Sub sbAutoAdjustColumnRowWidth()
'Auto ColumnFit
Columns(2).AutoFit
'Auto RowFit
Rows(2).AutoFit
End Sub
Sub sbChangeColumnWidth()
'Changing Columns B's Width
Columns("B").ColumnWidth = 25
'Changing the B-E Column Width
Columns("B:E").ColumnWidth = 25
End Sub
Sub sbChangeRowHeight()
'Changing the 3rd row Height
Rows(3).RowHeight = 25
'Changing the 3rd-25the row Height
Rows("4:25").RowHeight = 25
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment