- ©«¤l
- 31
- ¥DÃD
- 0
- ºëµØ
- 0
- ¿n¤À
- 31
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- office 2016
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2016-10-4
- ³Ì«áµn¿ý
- 2017-10-17
|
- Sub test()
- Dim d,d1,m%,n%,i%,j%,Rng, found
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- Range("c3:f" & Cells(Rows.Count, 3).End(xlUp).Row).Interior.Color = xlNone
- For i = 3 To Range("c3").End(xlDown).Row
- d(Cells(i, 3).Value) = ""
- Next i
- k = d.keys
- For i = 0 To UBound(k)
- For j = 3 + n To Range("c3").End(xlDown).Row
- If k(i) = Cells(j, 3) Then
- m = m + 1
- n = n + 1
- Else
- Set Rng = Cells(j - m, 3).Resize(m, 4)
- For Each Cell In Rng.Range(Cells(1, 4), Cells(Rng.Rows.Count, 4))
- If CDate(Split(Cell.Value, " ")(0)) = Date Then
- found = True
- d1(Split(Cell.Value, " ")(0)) = ""
- Else
- d1(Split(Cell.Value, " ")(0)) = ""
- End If
- Next Cell
- k1 = d1.keys
- Select Case d1.Count
- Case 1
- If CDate(k1(0)) = Date Then
- Rng.Interior.Color = 255
- End If
- Case 2
- If found = True Then
- For ii = 1 To Rng.Rows.Count
- If CDate(Split(Rng.Cells(ii, 4), " ")(0)) <> Date Then
- Rng.Cells(ii, 1).Resize(1, 4).Interior.Color = 16711935
- End If
- Next ii
- End If
- Case Else
- If found = True Then
- For ii = 1 To Rng.Rows.Count
- If CDate(Split(Rng.Cells(ii, 4), " ")(0)) = Date Then
- Rng.Cells(ii, 1).Resize(1, 4).Interior.Color = 255
- End If
- Next ii
- End If
- End Select
- m = 0
- found = False
- d1.RemoveAll
- Exit For
- End If
- Next j
- Next i
- If Range("a2") <> "" Then
- Set Rng = Range("c3:c" & Cells(Rows.Count, 3).End(xlUp).Row)
- For i = 1 To Rng.Rows.Count
- If Rng.Cells(i) = Range("a2") Then
- Rng.Resize(i, 4).Interior.Color = xlNone
- End If
- Next i
- End If
- End Sub
½Æ»s¥N½X ¦^´_ 1# RCRG |
|