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

[µo°Ý] ¦p¦ó§Q¥ÎVBA«öÁä¡A¨Ó§ä¥X¹H¤Ï³W«hªº¸¹½X¡C

¦^´_ 20# yen956


To yen956¤j   
ÄY­«²§±`³B²z§¹¡A´« "ÄY­«²§±`2" ¦³°ÝÃD¤F...XD¡A½Ð°Ñ¦Ò¤U¦CÀɮסA3Q¡I
20151223_¦p¦ó§Q¥ÎVBA«öÁä¡A¨Ó§ä¥X¹H¤Ï³W«h¸¹½X.rar (22.38 KB)

TOP

¦^´_ 21# RCRG
·PÁÂÁ¦A¤T´ú¸Õ,³y¦¨¤£«K, ÁٽХ]²[!!
³o­Óª©¥», ¿é¥X¦ì¸m¬G·N»P­ã¤j¿ù¶}, ¤è«K§A¤ñ¹ï.
¸Õ¸Õ¬Ý:
  1. '´¡¤J§Ç¸¹, ¥H«K«ì´_­ìª¬
  2. Sub ´¡¤J§Ç¸¹(LstR As Integer)
  3.     Dim I As Integer
  4.     For I = 2 To LstR
  5.         Cells(I, 10) = I
  6.     Next
  7. End Sub
  8. Sub test()
  9.     Dim LstR As Integer, LstR2 As Integer, sR As Integer, I As Integer, cnt As Integer
  10.     Dim maxDate As Date
  11.     Sheets("ÄY­«¿ù»~").Select
  12.     [H2:J65536] = ""
  13.     [H:J].Interior.ColorIndex = xlNone    '²M°£©³¦â
  14.     LstR2 = Cells(Rows.Count, 3).End(xlUp).Row
  15.     ´¡¤J§Ç¸¹ LstR:=LstR2      '´¡¤J§Ç¸¹, ¥H«K«ì´_­ìª¬
  16.     [A1].Resize(LstR2, 10).Sort _
  17.             Key1:=[C1], Order1:=xlAscending, _
  18.             Key2:=[G1], Order1:=xlAscending, _
  19.             Header:=xlYes
  20.     LstR = Cells(Rows.Count, 3).End(xlUp).Row
  21.     sR = 2
  22.     Do
  23.         cnt = sR
  24.         Do
  25.             '³W«h2.¸¹½X¬Û¦P, ¥B»s³y¤é¦³±Æ§Ç, «h¨ì´Á¤é¤]¥²¶·±Æ§Ç
  26.             If Cells(sR, 3) = Cells(sR + 1, 3) And Cells(sR, 5) > Cells(sR + 1, 5) Then
  27.                 Cells(sR, 9) = "²§±`2a"
  28.                 Cells(sR, 9).Interior.ColorIndex = 38
  29.             End If
  30.            '³W«h1.¸¹½X¬Û¦P, ¥B»s³y¤é¬Û¦P, ¦ý¨ì´Á¤é¤£¦P
  31.             If Cells(sR, 3) = Cells(sR + 1, 3) And Int(Cells(sR, 7)) = Int(Cells(sR + 1, 7)) And Cells(sR, 5) <> Cells(sR + 1, 5) Then
  32.                 Cells(sR, 8) = "²§±`1"
  33.                 Cells(sR, 8).Interior.ColorIndex = 8
  34.                 Cells(sR + 1, 8) = "²§±`1"
  35.                 Cells(sR + 1, 8).Interior.ColorIndex = 8
  36.             End If
  37.             sR = sR + 1
  38.         Loop Until Cells(sR, 3) <> Cells(sR + 1, 3) Or sR >= LstR    'ª½¨ì ¸¹½X¤£¦P ©Î ¸ê®Æµ²§À
  39.         For I = cnt To sR
  40.             maxDate = Application.Max(Cells(I, 5).Resize(sR - 1, 1))
  41.             '³W«h2.¸¹½X¬Û¦P, ¥B»s³y¤é¦³±Æ§Ç, «h¨ì´Á¤é¤]¥²¶·±Æ§Ç
  42.             If Cells(I, 3) = Cells(I + 1, 3) And Cells(I, 5) > maxDate Then
  43.                 Cells(I, 9) = "²§±`2b"
  44.                 Cells(I, 9).Interior.ColorIndex = 38
  45.             End If
  46.         Next
  47.     Loop Until sR >= LstR  'ª½¨ì¸ê®Æµ²§À
  48.     '«ì´_­ìª¬
  49.     [A1].Resize(LstR2, 10).Sort _
  50.             Key1:=[J1], Order1:=xlAscending, _
  51.             Header:=xlYes
  52. End Sub
½Æ»s¥N½X

TOP

¦^´_ 22# yen956


    ·PÁÂyen956¤j¦A«×À°¦£­×§ï¡A¥Ø«e´ú¸Õ¤âÃ䪺¸ê®Æ¬O§¹¥þ¨S°ÝÃDªº¡F
§Ú¤£¤ÓÀ´VBAÅÞ¿è¡A©Ò¥H¤£ª¾¹D¬°¤°»ò·ÓµÛ²§±`1©M²§±`2ªº­ì«h¨«¡A«oÁÙ¬O¦³¨Ç¸ê®ÆÁÙ·|¦³°ÝÃD(¦p¥ý«eªºÄY­«¿ù»~1©M2)¡A
©Ò¥H¤£ª¾¹D¦³¨S¦³¥i¯à¤U¦¸ªº¸ê®Æ¤S·|¦³¤£¦Pªº·s°ÝÃD¡A¬O¦³ÂI¾á¤ß°Õ¡I¤£¹L²{ªp¦³À°§Ú¸Ñ¨M¨ì¤F´N¦n¡AÁÙ¬O«Ü·PÁÂyen956¤j¡A·íµMÁÙ¦³­ã¤j¡A¨âºØª©¥»§Ú³£³ßÅw¡A©Ò¥H³o¬O§Ú­º¦¸¤@¦¸±Ä¥Î¨âª©¥»¡F
³Ì«á¡A¦A¦¸ÁÂÁ¨â¦ì¦h¦¸­×§ï»PÀ°¦£¡I3Q

TOP

        ÀR«ä¦Û¦b : §g¤l¬°¥Ø¼Ð¡A¤p¤H¬°¥Øªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD