Flip Horizontal/Vertical in Excel
I’ve had to write this a couple of times, so I’m posting it here so that I can have it for the next time, assuming I’ll remember it’s here. It’s just a vba script for excel to pivot your list of horizontal or vertical items the opposite way. Nothing too fancy, but it will save you 20 minutes of writing it out yourself. I’m sure there’s a way to do this in Excel, but I haven’t found it.
Public Sub flipDataHorizontal()
Range(“a1″).Select
Dim i As Integer
For i = 1 To 200
ActiveCell.Offset(i, 0) = ActiveCell.Offset(0, i)
ActiveCell.Offset(i, 0).NumberFormat = ActiveCell.Offset(0, i).NumberFormat
Next
End SubPublic Sub makeColumns()
Range(“a1″).Select
Dim i As Integer
For i = 1 To 200
ActiveCell.Offset(0, i + 1) = ActiveCell.Offset(i, 0)
ActiveCell.Offset(0, i + 1).NumberFormat = ActiveCell.Offset(i, 0).NumberFormat
Next
Columns(“a”).Delete
End Sub

Select the horizontal cells and then while hovering over the selection right-click with your mouse and select “Copy” then select the uppermost cell of where you would like to paste the selection vertically and right-click again, now select “Paste Special…” then check “transpose” then click “OK”.
Zentac
May 7, 2009 at 8:04 am
This method worked very well when I have only one row of data (5 columns). Thanks! But when I tried on multiple rows it didn’t work. Any suggestions?
Songqian
May 17, 2009 at 6:30 pm
God love ya zentak. Thanks. MUCH MUCH EASIER.
matt
May 7, 2009 at 8:07 am