Hello,
I'm writing a code that transpose 2D to 1D but it refuse to work. Please help to modify my code that make it work
Example:
Sheet1, data is in a range A2:E6
needs to be copied (transposed) onto
Sheet1, in a range D10:D34
> First row of the array (Sheet1!A2:E2) goes into Sheet1!D10:D14
> Second row (Sheet1!A3:E3) goes into Sheet2!D15:D19
> ... and so forth
Many thanks!
I'm writing a code that transpose 2D to 1D but it refuse to work. Please help to modify my code that make it work
Example:
Sheet1, data is in a range A2:E6
needs to be copied (transposed) onto
Sheet1, in a range D10:D34
> First row of the array (Sheet1!A2:E2) goes into Sheet1!D10:D14
> Second row (Sheet1!A3:E3) goes into Sheet2!D15:D19
> ... and so forth
Many thanks!
Sub two_dimensional_array()
Dim table(1 To 5, 1 To 5) As Variant
Dim i As Integer, r As Integer
For i = 1 To 5
For r = 1 To 5
table(i, r) = Cells(i + 1, r)
Next r
Next i
Range("d10:d34").Value = Excel.Application.Transpose(table)
End Sub