|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test()
- Dim arr, brr(), d, k As Integer, m As Integer, n As Integer
- arr = Range("a7").CurrentRegion.Value
- Set d = CreateObject("scripting.dictionary")
- ReDim Preserve brr(1 To 1000, 1 To UBound(arr, 2))
- For k = 2 To UBound(arr) - 1
- If Not d.exists(arr(k, 2)) Then
- n = n + 1
- d(arr(k, 2)) = n
- brr(n, 1) = arr(k, 1)
- brr(n, 2) = arr(k, 2)
- brr(n, 3) = arr(k, 3)
- Else
- m = d(arr(k, 2))
- If (arr(k, 3)) >= brr(m, 3) Then brr(m, 1) = arr(k, 1): brr(m, 3) = arr(k, 3)
- End If
- Next k
- Columns(6).NumberFormatLocal = "@"
- Range("f8").Resize(n, 3) = brr
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|