- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
¸Õ¸Õ¬Ý:- '´¡¤J§Ç¸¹, ¥H«K«ì´_쪬
- Sub ´¡¤J§Ç¸¹(LstR As Integer)
- Dim i As Integer
- For i = 2 To LstR
- Cells(i, 1) = i
- Next
- End Sub
- Sub test()
- Dim LstR As Integer, LstR2 As Integer, sR As Integer
- Dim mDate1 As Date, mDate2 As Date
- [H2:J65536] = ""
- '²M°£©³¦â, ¦p§A즳©³¦âªº»Ý¨D, ½Ð±N¤U¦C¥h°£
- [C:I].Interior.ColorIndex = xlNone
- LstR2 = Cells(Rows.Count, 3).End(xlUp).Row
- ´¡¤J§Ç¸¹ LstR:=LstR2 '´¡¤J§Ç¸¹, ¥H«K«ì´_쪬
- [A1].Resize(LstR2, 10).Sort _
- Key1:=[C1], Order1:=xlAscending, _
- Key2:=[G1], Order1:=xlAscending, _
- Key3:=[E1], Order1:=xlAscending, _
- Header:=xlYes
- LstR = Cells(Rows.Count, 3).End(xlUp).Row
- sR = 2
- mDate1 = DateSerial(Year(Cells(sR, 7)), Month(Cells(sR, 7)), Day(Cells(sR, 7)))
- Do
- '·s¼W²§±`¬ö¿ý,¦pµL¦¹»Ý¨D,½Ð¥h°£
- If Cells(sR, 5) < mDate1 Then '¨ì´Á¤é<»s³y¤é
- Cells(sR, 8) = "¨ì´Á¤é<»s³y¤é"
- '¥[¤J©³¦â, ¦p§A즳©³¦âªº»Ý¨D, ½Ð±N¤U¨â¦C¥h°£
- Cells(sR, 8).Interior.ColorIndex = 38
- Cells(sR, 3).Resize(1, 5).Interior.ColorIndex = 38
- End If
-
- If sR = 2 Then GoTo Next1:
- ' '¸¹½X¬Û¦P,¨ì´Á¤é¥¼±Æ§Ç(³W«h2 ¦ü¥G¨S¦³¦s¦bªº¥²n, ¬G¥h°£)
- ' If Cells(sR, 3) = Cells(sR - 1, 3) And Cells(sR, 5) < Cells(sR - 1, 5) Then
- ' Cells(sR, 10) = "¨ì´Á¤é¥¼±Æ§Ç"
- ' '¥[¤J©³¦â, ¦p§A즳©³¦âªº»Ý¨D, ½Ð±N¤U¦C¥h°£
- ' Cells(sR, 3).Resize(1, 5).Interior.ColorIndex = 6
- ' End If
-
- '»s³y¤é¬Û¦P, ¦ý¨ì´Á¤é¤£¦P
- If mDate1 = mDate2 And Cells(sR, 5) <> Cells(sR - 1, 5) Then
- Cells(sR - 1, 9) = "¨ì´Á¤é²§±`"
- '¥[¤J©³¦â, ¦p§A즳©³¦âªº»Ý¨D, ½Ð±N¤U¨â¦C¥h°£
- Cells(sR - 1, 9).Interior.ColorIndex = 8
- Cells(sR - 1, 3).Resize(1, 5).Interior.ColorIndex = 8
- Cells(sR, 9) = "¨ì´Á¤é²§±`"
- '¥[¤J©³¦â, ¦p§A즳©³¦âªº»Ý¨D, ½Ð±N¤U¨â¦C¥h°£
- Cells(sR, 9).Interior.ColorIndex = 8
- Cells(sR, 3).Resize(1, 5).Interior.ColorIndex = 8
- End If
- Next1:
- sR = sR + 1
- mDate1 = DateSerial(Year(Cells(sR - 1, 7)), Month(Cells(sR - 1, 7)), Day(Cells(sR - 1, 7)))
- mDate2 = DateSerial(Year(Cells(sR, 7)), Month(Cells(sR, 7)), Day(Cells(sR, 7)))
- Loop Until sR > LstR
- '«ì´_쪬, ¤è«K¬d®Ö
- [A1].Resize(LstR2, 9).Sort _
- Key1:=[A1], Order1:=xlAscending, _
- Header:=xlYes
- End Sub
½Æ»s¥N½X |
|