|
我是初学EXCEL VBA, 下面是弄出来的代码,但是运行时的计算速度太慢了,哪位高手能给我学习的机会吗? 谢谢 excelhome 的高手们!
Dim i As Integer
For i = 2 To 500
If Range("a" & i) = "" Then Exit Sub
Sheet4.Cells(i, 27).Value = WorksheetFunction.Sum(Sheet4.Range(Sheet4.Cells(i, 7), Sheet4.Cells(i, 26)))
Sheet4.Cells(i, 48).Value = WorksheetFunction.Sum(Sheet4.Range(Sheet4.Cells(i, 28), Sheet4.Cells(i, 47)))
Sheet4.Cells(i, 69).Value = WorksheetFunction.Sum(Sheet4.Range(Sheet4.Cells(i, 49), Sheet4.Cells(i, 68)))
Sheet4.Cells(i, 90).Value = WorksheetFunction.Sum(Sheet4.Range(Sheet4.Cells(i, 70), Sheet4.Cells(i, 89)))
Sheet4.Cells(i, 111).Value = WorksheetFunction.Sum(Sheet4.Range(Sheet4.Cells(i, 91), Sheet4.Cells(i, 110)))
Sheet4.Cells(i, 132).Value = WorksheetFunction.Sum(Sheet4.Range(Sheet4.Cells(i, 112), Sheet4.Cells(i, 131)))
Sheet4.Cells(i, 153).Value = WorksheetFunction.Sum(Sheet4.Range(Sheet4.Cells(i, 133), Sheet4.Cells(i, 152)))
Sheet4.Cells(i, 174).Value = WorksheetFunction.Sum(Sheet4.Range(Sheet4.Cells(i, 154), Sheet4.Cells(i, 173)))
Sheet4.Cells(i, 175).Value = Sheet4.Cells(i, 27).Value + Sheet4.Cells(i, 48).Value + Sheet4.Cells(i, 69).Value + Sheet4.Cells(i, 90).Value + Sheet4.Cells(i, 111).Value + Sheet4.Cells(i, 132).Value + Sheet4.Cells(i, 153).Value + Sheet4.Cells(i, 174).Value
Next
End Sub
|
|