Excel Transpose 改變動態二維陣列的「列」邊界

技巧124      p.188



Sub AddArrayBorder()

    Dim i As Integer

    Dim j As Integer

    Dim arr

    ReDim arr(1 To 2, 1 To 3)

    For i = 1 To 2

        For j = 1 To 3

            arr(i, j) = i * j

        Next j

    Next i

    arr = Application.WorksheetFunction.Transpose(arr)

    ReDim Preserve arr(1 To 3, 1 To 5)

    arr = Application.WorksheetFunction.Transpose(arr)

    For i = 3 To 5

        For j = 1 To 3

            arr(i, j) = i * j

        Next j

    Next i

    Sheet1.Range("A1").Resize(5, 3) = arr

End Sub

留言

這個網誌中的熱門文章

超任 三國志3代,登入武將金手指

歐姆龍 HEM-7600T 評價,購買心得分享(打臉文)

年青人眼鏡評價(負評),辛酸血淚史分享文