|

楼主 |
发表于 2024-8-16 12:25
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
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
|
|