|
- Private Sub 筛选_Click()
- Set d = CreateObject("scripting.dictionary")
- With Sheet1
- arr = .[a1].CurrentRegion
- [color=Red] stime = DTPicker1.Value: etime = DTPicker2.Value[/color]
- .[a1].CurrentRegion.Interior.ColorIndex = 0
- For i = 2 To UBound(arr)
- If arr(i, 1) >= stime And arr(i, 1) <= etime Then
- .Cells(i, 1).Interior.ColorIndex = 6
- d(arr(i, 2)) = d(arr(i, 2)) + 1
- End If
- Next
- End With
-
- With Sheet2
- .Activate
- .Range("a2:b1000").ClearContents
- .Cells(2, 1).Resize(d.Count, 1) = Application.Transpose(d.keys)
- .Cells(2, 2).Resize(d.Count, 1) = Application.Transpose(d.items)
- End With
- End Sub
复制代码 |
|