|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
自建转置函数- 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
复制代码 |
评分
-
2
查看全部评分
-
|