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

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

¦^´_ 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

        ÀR«ä¦Û¦b : ¤H­nª¾ºÖ¡B±¤ºÖ¡B¦A³yºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD