***************************************************************
配列の縦と横を逆転させる
※1次配列(横)の場合は、2次配列(縦)にする
【引数】DataAry:1次元or2次元配列
Trans:貼付け時、配列の行・列を入れ替えるオプション
※1次元配列の場合、2次元配列に変換し、縦方向に張り付ける
***************************************************************
Public Function fArray_Trans(DataAry As Variant) As Variant
'+ 配列を逆転する(1次配列(横)の場合は、2次配列(縦)にする)
'- AppのTransposeでは,行or列方向の要素数が65536を超えた場合「型が一致しない」とエラーになる。
'+ AppのTransposeとの処理速度は、ほとんど変わらない微差
Dim RetAry As Variant
Dim Row_L As Long
Dim Row_U As Long
Dim Col_L As Long
Dim Col_U As Long
Call fArray_Lbound_Ubound(DataAry, Row_L, Row_U, Col_L, Col_U)
Dim CntDim As Long
CntDim = fArray_DimCount(DataAry)
Select Case CntDim
Case 1
ReDim RetAry(Row_L To Row_U, Row_L To Row_L)
Dim i As Long
For i = Row_L To Row_U
RetAry(i, Row_L) = DataAry(i)
Next
Case 2
ReDim RetAry(Col_L To Col_U, Row_L To Row_U)
Dim j As Long
For j = Col_L To Col_U
For i = Row_L To Row_U
RetAry(j, i) = DataAry(i, j)
Next
Next
End Select
fArray_Trans = RetAry
End Function