
'多个相同日期算一天
Option Explicit
Sub abc()
Dim i, a, t, d(1), m, n, r As Range
For i = 0 To UBound(d)
Set d(i) = CreateObject("scripting.dictionary")
Next
i = Cells(Rows.Count, "a").End(xlUp).Row
Set r = Range("a2:h" & i).SpecialCells(xlCellTypeVisible)
ReDim a(1 To 10 ^ 4 * 8)
For Each i In r
m = m + 1
a(m) = i.Value
If m Mod 8 = 0 Then
If Len(a(m - 7)) Then d(0)(a(m - 7) & Space(1) & a(m)) = 1
End If
Next
For Each i In d(0).keys
t = Split(i)(0)
d(1)(t) = d(1)(t) + d(0)(i)
Next
With [k1]
.Resize(10 ^ 4, 2).ClearContents
If d(1).Count > 0 Then .Resize(d(1).Count, 2) = _
Application.Transpose(Array(d(1).keys, d(1).items))
Debug.Print d(1).Count
End With
End Sub