Option
Explicit
Public
Function
M_Trans(Base_Matrix
As
Range)
As
Variant
Dim
i
As
Integer
, j
As
Integer
Dim
row_no
As
Integer
, column_no
As
Integer
Dim
matrix()
As
Variant
, matrix2()
As
Variant
matrix = Base_Matrix.Value
row_no = UBound(matrix, 1)
column_no = UBound(matrix, 2)
ReDim
matrix2(1
To
column_no, 1
To
row_no)
For
j = 1
To
column_no
Step
1
For
i = 1
To
row_no
Step
1
matrix2(j, i) = matrix(i, j)
Next
i
Next
j
M_Trans = matrix2
End
Function