How can I fit my row heights to the data?

  • Thread starter Thread starter Jeff Heikkinen
  • Start date Start date
J

Jeff Heikkinen

I have an Excel file with several sheets that are basically glorified
laundry lists; all that's in any given cell is text or a simple number
that I don't need to do any calculations on. (It's information on some
of the abilities available to characters in an RPG I run, if that helps
anyone visualise it.)

Here's the problem: whenever I sort this list or otherwise appreciably
change the order of it, it screws up my row heights. Some rows end up
too small for the text in them while others have huge amounts of white
space in the top. I am 100% uninterested in going through and manually
fixing them all every time I do this. How do I get each row to
automatically be just large enough to display all the text in whatever
cell ends up the "tallest"?
 
Try Running a macro

Here is an example

Sub FitRows()
Dim wrk As Workbook
Dim wks As Worksheet
Dim i As Long

Set wrk = ThisWorkbook
Set wks = wrk.ActiveSheet

For i = 1 To wks.UsedRange.Rows.Count
Rows(i).EntireRow.AutoFit
Next

Set wks = Nothing
Set wrk = Nothing
End Su


-
XLMacroMa
 
Back
Top