|
代码如下。。。。
Sub test()
Dim wb As Workbook, sht As Worksheet
Set wb = ThisWorkbook
Set sht = wb.Sheets("sheet1")
arr = sht.[a1].CurrentRegion
Set d = CreateObject("scripting.dictionary")
ReDim brr(1 To 10000, 1 To 100)
For i = 2 To UBound(arr)
s = arr(i, 1)
If s <> Empty Then
If Not d.exists(s) Then
n = n + 1
d(s) = n
brr(1, n) = "今日" & arr(i, 2)
brr(10000, n) = 1
End If
End If
Next
For i = 2 To UBound(arr)
Key = d.keys
s = arr(i, 3)
If d.exists(Left(s, 4)) Then
m = d(Left(s, 4))
brr(10000, m) = brr(10000, m) + 1
brr(brr(10000, m), m) = arr(i, 4)
x = Application.Max(x, brr(10000, m))
End If
Next
sht.[k1].Resize(x, n) = brr
Beep
Set d = Nothing
End Sub
|
|