Monday, July 01, 2013

Quickly Line Up Rows/Columns in Excel

Have you ever pasted a table into Excel and gotten results like this?


No like!

Wouldn't it be nice to line up and autofit all the rows and columns in one click?  Here's a quick macro that will allow you to do just that:

    Cells.Select
  Selection.ColumnWidth = 255 
  Cells.EntireRow.AutoFit 
  Selection.ColumnWidth = 9 
  Cells.EntireColumn.AutoFit 'fit the columns

Basically, it selects all the cells, makes the column extremely wide, then autofits the rows and columns.  The result is more like this:


Much better.  Enjoy!

No comments: