How to Transpose a Number of Rows to Columns in Excel

How to transpose Rows to Columns in Excel

Some times when pasting output from HTML, to excel all data will get pasted in to Rows.

Transpose Example one

To fix this, you can run the Excel Macro below.

Step 1:  Go to File -> Options and Select Customize Ribbon.

On the right hand side click on Developer to enable Macros

From the Developer tab, Click Macros.  Type the Name: TransposeRows_to_Columns

Click Create:

Paste the following Commands and run the Macro

Sub TransposeRows_to_Columns()
'
' TransposeRows_to_Columns Macro
' Transpose every X Rows to Columns
'
Dim rng As Range
Dim I As Long
Dim RowstoTranspose As Long
  RowstoTranspose = 3
    Set rng = Range("A1")
    While rng.Value <> ""
        I = I + 1
        rng.Resize(RowstoTranspose).Copy
        Range("B" & I).PasteSpecial Transpose:=True
        Set rng = rng.Offset(RowstoTranspose)
        
    Wend
    rng.EntireColumn.Delete
End Sub

Changing the RowstoTranspose variable will change the number of Rows you want to transpose to data.

Transpose 2