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

[¨D§U] ±N°}¦C¸ê®Æ¿z¿ï, «ö±ø¥ó¤À¦C

[¨D§U] ±N°}¦C¸ê®Æ¿z¿ï, «ö±ø¥ó¤À¦C

¥»©«³Ì«á¥Ñ sammyc ©ó 2011-12-1 16:29 ½s¿è

¦³¤@°}¦C, ¤º¦³¤u¸¹,¤é´Á¤Î®É¶¡, ¦p¦ó±N¨ä«ö¤u¸¹,¤Î¤é´Á ¦A«ö®É¬q±N¼Æ¾Ú¤À¦C±Æ¥X ?

ScreenHunter_04 Dec. 01 16.23.jpg (68.2 KB)

ScreenHunter_04 Dec. 01 16.23.jpg

¬¡­¶Ã¯5.rar (6.16 KB)

50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

¦^´_ 1# sammyc
³Ì«áªº®É¶¡°Ï¬q ¤Ö¤@­Ó0         214500-223000
   
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Ar(1 To 6), i, ii, F As Boolean
  4.     For i = 1 To 6
  5.         Ar(i) = Split(Range("G3").Cells(1, i), "-")   'Ū¨ú®É¶¡°Ï¬q
  6.     Next
  7.     With Range("E2")
  8.     i = 2
  9.         .CurrentRegion.Offset(2).Clear
  10.         Do While Cells(i, "C") <> ""                   'Ū¨ú¸ê®Æ
  11.             .Offset(i) = Cells(i, "C")
  12.             .Offset(i, 1) = Cells(i, "A")
  13.             F = True                                    '¤ñ¸û«eªºÅܼÆ=True
  14.             For ii = 1 To 6                             '¦b6¬q®É¶¡¸Ì¤ñ¸û«á¨ú±o®É¶¡°Ï¬q
  15.                 If Val(Cells(i, "B")) >= Val(Ar(ii)(0)) And Val(Cells(i, "B")) <= Val(Ar(ii)(1)) Then
  16.                     .Offset(i, ii + 1) = Cells(i, "B")
  17.                     F = False                           '¦³¨ú±o®É¶¡°Ï¬qªºÅܼÆ=False
  18.                     Exit For
  19.                 End If
  20.             Next
  21.             If F = True Then .Offset(i, ii + 1) = Cells(i, "B")
  22.             i = i + 1
  23.         Loop
  24.     End With
  25. End Sub
½Æ»s¥N½X

TOP

¥ýÁÂÁ¤j¤jªº±Ð¾É, ¦ý°õ¦æ«á, ¦P¤@¤é´Á·|¥X²{¦h¦æ

ScreenHunter_05 Dec. 01 17.52.jpg (109 KB)

ScreenHunter_05 Dec. 01 17.52.jpg

50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 3# sammyc
©êºp¦³ÂI²´ªá¨S¬Ý²M·¡ÃD·N
§ó¥¿:
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Ar(), TimeAr(1 To 6), i As Long, ii As Long, R As Integer, F As Boolean
  4.     Ar = Range("A1").CurrentRegion                        '³Æ¥÷¸ê®Æ
  5.     Range("A1").CurrentRegion.Sort Key1:=Range("C2"), Order1:=xlAscending, Key2:=Range("A2"), Order1:=xlAscending, Header:=xlYes  '±Æ§Ç¸ê®Æ
  6.     For i = 1 To 6
  7.         TimeAr(i) = Split(Range("G3").Cells(1, i), "-")   'Ū¨ú®É¶¡°Ï¬q¥[¤J¬°TimeAr°}¦Cªº¤¸¯À
  8.     Next
  9.     With Range("E2")
  10.         i = 2                                              'Ū¨ú¸ê®Æ¦C
  11.         R = 2                                              '¼g¤J gx,dateªº¸ê®Æ¦C
  12.         .CurrentRegion.Offset(2).Clear                     '²M°£ ¼g¤J°Ï
  13.         Do
  14.             Do
  15.                 .Offset(R) = Cells(i, "C")                  '¼g¤J gx
  16.                 .Offset(R, 1) = Cells(i, "A")               '¼g¤J date
  17.                 F = True                                    '¤ñ¸û«eªºÅܼÆ=True
  18.                 For ii = 1 To 6                             '¦b6¬q®É¶¡¸Ì¤ñ¸û«á¨ú±o®É¶¡°Ï¬q
  19.                     If Val(Cells(i, "B")) >= Val(TimeAr(ii)(0)) And Val(Cells(i, "B")) <= Val(TimeAr(ii)(1)) Then
  20.                         .Offset(R, ii + 1) = Cells(i, "B")  '¼Æ­È¼g¤J®É¶¡°Ï¬q
  21.                         F = False                           '¦³¨ú±o®É¶¡°Ï¬qªºÅܼÆ=False
  22.                         Exit For                            'Â÷¶}°j°é
  23.                     End If
  24.                 Next
  25.                 If F = True Then .Offset(R, ii + 1) = Cells(i, "B")
  26.                 If Cells(i, "A") <> Cells(i + 1, "A") Then R = R + 1     '¤£¦Pdate©¹¤U¤@¦æ
  27.                 i = i + 1
  28.             Loop Until Cells(i, "C") <> Cells(i + 1, "C") Or Cells(i + 1, "C") = ""  '¨Ì§ÇŪ¨ú¸ê®Æª½¨ì  gx ¤£¬Û¦P,©Î¸ê®Æ¬°ªÅ¥Õ
  29.         Loop Until Cells(i, "C") = ""                                                '¨Ì§ÇŪ¨ú¸ê®Æ°j°éª½¨ì¸ê®Æ¬°ªÅ¥Õ
  30.     End With
  31.     Range("A1").CurrentRegion = Ar                            'ÁÙ­ì¸ê®Æ
  32. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# GBKEE

ÁÂÁÂ, ¤v¥i¨M°ÝÃD,
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

        ÀR«ä¦Û¦b : ¤f»¡¦n¸Ü¡B¤ß·Q¦n·N¡B¨­¦æ¦n¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD