Sub Horizontal_Vertical()
Dim c As Range, i As Long
i = 5
For Each c In Range("L2:S2")
Range("L" & i).Resize(2).Value = Application.Transpose(Array(c, c.Offset(1)))
i = i + 2
Next
End Sub
I had to adjust some ranges with your code, but works perfectly!!How about:
VBA Code:Sub Horizontal_Vertical() Dim c As Range, i As Long i = 5 For Each c In Range("L2:S2") Range("L" & i).Resize(2).Value = Application.Transpose(Array(c, c.Offset(1))) i = i + 2 Next End Sub
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value"),
#"Sorted Rows" = Table.Sort(#"Unpivoted Columns",{{"Attribute", Order.Ascending}}),
#"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"Attribute"})
in
#"Removed Columns"
Sub TransposeDoubleCellRange()
Dim LastCol As String
LastCol = Split(Cells(2, Columns.Count).End(xlToLeft).Address(, 0), "$")(0)
Range("L5").Resize(2 * (Cells(1, LastCol).Column - 11)) = Application.Transpose(Split(Join(Evaluate(Replace("L2:@2&"" ""&L3:@3", "@", LastCol)))))
End Sub