¥»©«³Ì«á¥Ñ color790 ©ó 2010-8-17 00:01 ½s¿è
1.·íBÄæ³o¤@¦æ¥Ñ¥¿Âàt¥Bµ´¹ïȤj©ó5(ex. abs(B10-B9) = 6)
2.·ítȶ}©lÅܤj®É(ex. B13)
3.¹ïÀ³¨ìAÄæ ¨BÆJ1 - ¨BÆJ2 (ex. C10= A10-A13)
4. «h¬°¤W±¨BÆJ¬Û¤Ï(·íBÄæ³o¤@¦æ¥ÑtÂॿ¥Bµ´¹ïȤj©ó5(ex.B15)--->¥¿È¶}©lÅܤp(ex. B19)--->¹ïÀ³¨ìAÄæ ¨BÆJ2 - ¨BÆJ1(ex. C19 - C15)
¥H¤U¬O§Ú¼gªº,¤]¬OµLªk°õ¦æ,¥i¥HÀ°§Úקï¤@¤U¶Ü?
Sub bbb()
For i = 3 To Worksheets("sheet1").Range("A1").End(xlDown).Row
j = i + 1
If Cells(i - 1, 2) < 0 And Cells(i, 2) > 0 And Abs(Cells(i - 1, 2) - Cells(i, 2)) > 5 Then
Do Until Cells(j, 2) < Cells(i, 2)
Cells(i, 3) = Cells(j, 1) - Cells(i, 1)
Else
If Cells(i - 1, 2) > 0 And Cells(i, 2) < 0 And Abs(Cells(i, 2) - Cells(i - 1, 2)) > 5 Then
Do Until Cells(j, 2) >Cells(i, 2)
Cells(i, 3) = Cells(i, 1) - Cells(j, 1)
End If
End If
Next
End Sub |