|
楼主 |
发表于 2024-8-16 12:25
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub test()
arr = Sheets("Sheet2").Range("B1:B9")
Set d = CreateObject("scripting.dictionary")
For i = 1 To UBound(arr)
d(Mid(arr(i, 1), 2, 1)) = d(Mid(arr(i, 1), 2, 1)) + 1
d(Mid(arr(i, 1), 2, 1)) = d(Mid(arr(i, 1), 2, 1)) + 1
Next
Sheets("Sheet3").Range("B1:C" & d.Count) = WorksheetFunction.Transpose(Array(d.keys, d.items))
Sheets("Sheet3").Range("D1:E" & d.Count) = WorksheetFunction.Transpose(Array(d.keys, d.items))
Set d = Nothing
End Sub
|
|