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
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
留言
張貼留言