How can I fit my row heights to the data?

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"?
 
X

XLMacroMan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top