|
|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
代码如下。。。
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
tm = Timer
Dim wb As Workbook, sht As Worksheet, sh As Worksheet
arr = Me.[b3].CurrentRegion
brr = Me.[i3].CurrentRegion
Set d = CreateObject("scripting.dictionary")
For i = 2 To UBound(arr)
For j = 1 To UBound(arr, 2)
s = arr(i, j)
If s <> Empty Then d(s) = d(s) + 1
Next
Next
Set dic = CreateObject("scripting.dictionary")
For i = 2 To UBound(brr)
For j = 1 To UBound(brr, 2)
s = brr(i, j)
If s <> Empty Then dic(s) = dic(s) + 1
Next
Next
Me.[s3].Resize(1000, 4).ClearContents
Me.[s3].Resize(d.Count, 2) = Application.Transpose(Array(d.keys, d.items))
Me.[u3].Resize(dic.Count, 2) = Application.Transpose(Array(dic.keys, dic.items))
Application.ScreenUpdating = True
Application.DisplayAlerts = True
MsgBox "共耗时:" & Format(Timer - tm, "0.0000") & " 秒!!!", 64
End Sub
|
|