|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub vv()
- Dim arr, brr
- arr = Sheet1.[a1].CurrentRegion
- ReDim brr(1 To UBound(arr), 1 To 6)
- Set d = CreateObject("scripting.dictionary")
- For i = 2 To UBound(arr)
- s = arr(i, 1) & arr(i, 2) & arr(i, 3) & arr(i, 4)
- If Not d.exists(s) Then
- k = k + 1
- d(s) = k
- For j = 1 To 5
- brr(k, j) = arr(i, j)
- Next
- brr(k, 6) = i
- Else
- If arr(i, 5) > brr(d(s), 5) Then
- brr(d(s), 5) = arr(i, 5)
- brr(d(s), 6) = i
- End If
- End If
- Next
- Sheet2.[a2:f55555] = ""
- Sheet2.[a2].Resize(k, 6) = brr
- End Sub
复制代码 |
|