|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
代码如下。。。
Sub test()
arr = Sheet1.[a1].CurrentRegion
Set d = CreateObject("scripting.dictionary")
ReDim brr(1 To UBound(arr), 1 To 3)
For i = 2 To UBound(arr)
If Len(arr(i, 4)) <> 0 Then
If Not d.exists(arr(i, 4)) Then
n = n + 1
d(arr(i, 4)) = n
brr(n, 1) = arr(i, 4)
brr(n, 3) = CDate(arr(i, 2))
brr(n, 2) = arr(i, 3)
Else
m = d(arr(i, 4))
If brr(m, 3) < CDate(arr(i, 2)) Then
brr(m, 3) = CDate(arr(i, 2))
brr(m, 2) = arr(i, 3)
End If
End If
End If
Next
With Sheet1
.[i1].CurrentRegion.ClearContents
.[i1:j1] = [{"车牌号","手机号"}]
.[i2].Resize(n, 2) = brr
End With
Set d = Nothing
Beep
End Sub
|
|