Forum Discussion
Robert1290
Nov 12, 2021Brass Contributor
Excel change row height based on font size
Hi, Is there a way of making excel change the row height, dependant on the font size in the cells, e.g. if font size is 12, then make row height 18... Thanks Rob
- Nov 12, 2021
That complicates things enormously. I'd either unmerge the cells, or resize the rows manually.
HansVogelaar
Nov 12, 2021MVP
- Robert1290Nov 12, 2021Brass ContributorHansVogelaar
Yes they will, and there are merged cells too.
There will likely be 4 or 5 different font sizes in a document.
Happy for VBA too, you helped me on my other VBA code that I still use 🙂
Rob- HansVogelaarNov 12, 2021MVP
Here is macro you can run:
Sub FixHeights() Dim rng As Range Application.ScreenUpdating = False For Each rng In Intersect(Range("A:A"), ActiveSheet.UsedRange) rng.RowHeight = 1.5 * rng.Font.Size Next rng Application.ScreenUpdating = True End Sub- Robert1290Nov 12, 2021Brass ContributorHansVogelaar
Thanks, I have ran this on my workbook, I am still getting the bottom of text being cut off in places. Is this because of the range used? Also, can you also write code that will increase a merged cell if not all of the wrapped text has fit into the cell intially?
Rob