2.
Sub aaa()
For i = 549 To Worksheets("sheet1").Range("A1").End(xlDown).Row
If Cells(i, 10) > Cells(i, 11) Then
Set x = Cells(i, 8)
Do Until Cells(i, 10) < Cells(i, 11) '紅色的i可以先加1嗎?也就是上面如果求出的i是5,這邊直接先代6,後面再每次以1增加,如果改成Do Until Cells(i+1, 10) < Cells(i, 11)這樣好像每次都增加2?
i = i + 1
Loop
Set y = Cells(i, 8)
x.Offset(, 23) = y - x
End If
Next
End Sub
謝謝各位~~~作者: Hsieh 時間: 2010-8-20 23:51
如果for i=549 to 這個迴圈要每個i都執行到
建議進入do Until之前用一變數如r
r=i+1
Do Until Cells(r, 10) < Cells(r, 11)
Cells(r, 11)
r = r + 1
Loop作者: color790 時間: 2010-8-22 00:08