ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

½Ð°Ý....³o­Ó­n«ç»ò­×§ï

½Ð°Ý....³o­Ó­n«ç»ò­×§ï

¥»©«³Ì«á¥Ñ color790 ©ó 2010-9-1 14:16 ½s¿è

¬°¤°»ò°õ¦æ¤F,¤@ÂI¤ÏÀ³¤]¨S¦³
½Ð°Ý­þ¸Ì»Ý­n­×§ï ?
Sub aa()
j = 2
For i = 2 To 5002
If Cells(i, 2) = TimeValue("09:30:00") And Cells(i, 1) = Cells(j, 16) Then     'aÄ欰¤é´Á,bÄ欰®É¶¡
x = Application.Max(Range(Cells(i - 2, 4), Cells(i, 4)))
Z = Application.Min(Range(Cells(i - 2, 5), Cells(i, 5)))
Do Until Cells(i, 4) > x + 30 And Cells(i, 1) = Cells(j, 16) Or Cells(i, 5) < Z
i = i + 1
Loop
If Cells(i, 5) < Z Then
Set y = Cells(i, 5)
Else
Set y = Cells(i, 4)
End If
y.Offset(, 7) = y - x
End If
j = j + 1
Next
End Sub
ªì¾ÇªÌcolor

¦^´_ 1# color790
³oµ{§Ç­nªº¬O¬Æ»ò?  §Ú¬Ý¤£À´  ¥i¥H§i¶D§Ú¶Ü?
If Cells(i, 2) = TimeValue("09:30:00") And Cells(i, 1) = Cells(j, 16) Then     'aÄ欰¤é´Á,bÄ欰®É¶¡
§â¬õ¦â0¥h±¼ ´N·|°Ê

TOP

¤w¤W¶Ç¦Üsheet2
ªì¾ÇªÌcolor

TOP

¦^´_ 3# color790
ªÑ²¼¤£¤ÓÀ´
  1. Sub aa()
  2. With Sheet1
  3.     For j = 2 To .Cells(Rows.Count, "P").End(xlUp).Row
  4.         For i = 2 To .Cells(Rows.Count, "A").End(xlUp).Row
  5.             If .Cells(i, "B") = TimeValue("9:30:00") And .Cells(i, "A") = .Cells(j, "P") Then     'aÄ欰¤é´Á,bÄ欰®É¶¡
  6.                 x = Application.Max(.Range(.Cells(i - 2, 4), .Cells(i, 4)))
  7.                 Z = Application.Min(.Range(.Cells(i - 2, 5), .Cells(i, 5)))
  8.                 Do Until .Cells(i, 4) > x + 30 And .Cells(i, 1) = .Cells(j, 16) Or .Cells(i, 5) < Z
  9.                     i = i + 1
  10.                 Loop
  11.                 If Cells(i, 5) < Z Then
  12.                     Set y = Cells(i, 5)
  13.                 Else
  14.                     Set y = Cells(i, 4)
  15.                 End If
  16.                 y.Offset(, 7) = y - x
  17.             End If
  18.         Next
  19.     Next
  20. End With
  21. End Sub
½Æ»s¥N½X

TOP

¤Ó·PÁ¤F.....
ªì¾ÇªÌcolor

TOP

        ÀR«ä¦Û¦b : ºw¤ô¦¨ªe¡C²É¦Ì¦¨ÅÚ¡A¤Å»´¤vÆF¡A¤Å¥Hµ½¤p¦Ó¤£¬°¡C
ªð¦^¦Cªí ¤W¤@¥DÃD