|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
'猜一个,输出[e11]
Option Explicit
Sub test()
Dim arr, i, j, t
With Sheets("sheet3")
arr = .[b1].CurrentRegion
ReDim brr(1 To 2, 1 To 33) As Long
For i = 1 To UBound(brr, 2): brr(1, i) = i: Next
For i = 2 To UBound(arr, 1)
t = Split(arr(i, 1), ",")
For j = 0 To UBound(t)
brr(2, t(j)) = brr(2, t(j)) + 1
Next j, i
For i = 1 To UBound(brr, 2) - 1
For j = i + 1 To UBound(brr, 2)
If brr(2, i) < brr(2, j) Then
t = brr(1, i): brr(1, i) = brr(1, j): brr(1, j) = t
t = brr(2, i): brr(2, i) = brr(2, j): brr(2, j) = t
End If
Next j, i
.[e11].Resize(UBound(brr, 1), UBound(brr, 2)) = brr
End With
End Sub |
|