|
楼主 |
发表于 2018-12-21 09:42
|
显示全部楼层
自建转置函数
Function TranVariant(ByVal vData As Variant) As Variant
'转置数组
Dim vNewData As Variant, nRow As Double, nCol As Double
If IsArray(vData) Then
ReDim vNewData(1 To UBound(vData, 2) - LBound(vData, 2) + 1, 1 To UBound(vData) - LBound(vData) + 1)
For nRow = 1 To UBound(vNewData)
For nCol = 1 To UBound(vNewData, 2)
If Not IsNull(vData(nCol + LBound(vData, 2) - 1, nRow + LBound(vData) - 1)) Then _
vNewData(nRow, nCol) = vData(nCol + LBound(vData, 2) - 1, nRow + LBound(vData) - 1)
Next
Next
vData = vNewData
End If
TranVariant = vData
End Function
http://club.excelhome.net/thread-1452553-1-1.html
2楼 |
评分
-
2
查看全部评分
-
|