超まとめ
WorksheetFunction.Transpose(<二次元配列>)で、行と列を入れ替えた結果(2次元配列)を取得できます。
変換後の配列の開始インデックスは1からになることに注意が必要です。
詳しく
二次元配列を作って、WorksheetFunction.Transposeを使って行と列を入れ替えるサンプルプログラムです。
Sub test()
'行列入れ替え前の2次元配列
Dim baseArray()
ReDim baseArray(1 To 3, 1 To 2)
'テストデータ作成
Dim currentValue
currentValue = 0
Dim cnt1, cnt2
For cnt1 = LBound(baseArray, 1) To UBound(baseArray, 1)
For cnt2 = LBound(baseArray, 2) To UBound(baseArray, 2)
baseArray(cnt1, cnt2) = currentValue
currentValue = currentValue + 1
Next
Next
'行列を入れ替え
Dim transedArray()
transedArray = WorksheetFunction.Transpose(baseArray) 'ここにブレークポイントを張って実行
End Sub
baseArrayが元々の二次元配列(2×3)で、transedArrayが行列入れ替えを行ったあとの配列です。
| 0 | 1 |
| 2 | 3 |
| 4 | 5 |
が
| 0 | 2 | 4 |
| 1 | 3 | 5 |
に変換され、行と列が入れ替わっているのがわかります。
注意点
Transposeの結果として得た二次元配列は、開始インデックスが「1」です。
入れ替え前の配列の開始インデックスがなんであろうと、1からスタートになりますので、この点は注意して遣う必要があります。

Thank you for the auspicious writeup. It in fact was a amusement account
it. Look advanced to far added agreeable from you! However,
how could we communicate?
Please on Twitter. My Account is @tfumiaki .
I am genuinely pleased to glance at this blog posts which includes
tons of helpful data, thanks for providing these kinds of information.