|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2024.8.15
- Dim arr, brr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("scripting.dictionary")
- With Sheets("Sheet1")
- r = .Cells(Rows.Count, "h").End(3).Row
- arr = .[h1].Resize(r, 2)
- ReDim brr(1 To UBound(arr), 1 To 2)
- For i = 2 To UBound(arr)
- s = arr(i, 2)
- If Not d.Exists(s) Then
- m = m + 1
- d(s) = m
- brr(m, 1) = arr(i, 2)
- brr(m, 2) = CStr(arr(i, 1))
- Else
- r = d(s)
- brr(r, 2) = IIf(InStr(brr(r, 2), CStr(arr(i, 1))), brr(r, 2), brr(r, 2) & "/" & arr(i, 1))
- End If
- Next
- .[s2].Resize(10000, 2) = ""
- .Range("s2").Resize(m, 2) = brr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
3
查看全部评分
-
|