以下是小弟經過oobird 大大指導寫的程式碼
只是實務應用上操作卻發生過於緩慢狀況
不知要如何修改才可以改善效率問題
另外
在工作表1中之資料
最多是74個
最少是0個
dim i%,j%,k%
i = 4
For Each c In Sheet1.[c10:c83]
Sheet2.Cells(i, 3) = c
i = i + 6
Next
j= 4
For Each c In Sheet1.[d10:d83]
Sheet2.Cells(i, 4) = c
j = j + 6
Next
k = 4
For Each c In Sheet1.[e10:e14]
Sheet2.Cells(i, 11) = c
k = k + 6
Next作者: oobird 時間: 2010-8-31 15:42
感謝oobird大大的指導
只是小弟愚昧..所以還有幾個問題..煩請大大解惑~~~
Dim a, r%, i%, arr()
==>陣列arr的宣告括號是空白..這代表是宣告哪種陣列?
With Sheets("1")
a = .Range(.[c10], .[e10].End(4))
==>range括號裡的.[c10], .[e10]這樣語法是何意義?小弟看不懂,小弟只看過前面沒有"點"的
==>End(4)...這樣的語法..小弟沒看過..所以不懂~~~~
End With
r = 1
For i = 1 To UBound(a)
ReDim Preserve arr(1 To 3, 1 To r)
arr(1, r) = a(i, 1): arr(2, r) = a(i, 2): arr(3, r) = a(i, 3)
r = r + 6
Next
Sheets("2").[c4].Resize(r - 6, 2) = Application.Transpose(arr)
Sheets("2").[k4].Resize(r - 6, 1) = Application.Transpose(Application.Index(arr, 3))