|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 统计()
Application.ScreenUpdating = False
Dim ar As Variant
Dim i As Long, r As Long, rs As Long
Dim br()
Dim d As Object
Set d = CreateObject("scripting.dictionary")
ReDim br(1 To 10000, 1 To 3)
For Each sh In Sheets
If sh.Index > 1 Then
ar = sh.[a1].CurrentRegion
For i = 2 To UBound(ar)
For j = 1 To UBound(ar, 2)
If Trim(ar(i, j)) <> "" Then
t = d(Trim(ar(i, j)))
If t = "" Then
k = k + 1
d(Trim(ar(i, j))) = k
t = k
br(k, 1) = ar(i, j)
br(k, 2) = sh.Name & "!" & sh.Cells(i, j).Address(0, 0)
End If
br(t, 3) = br(t, 3) + 1
End If
Next j
Next i
End If
Next sh
With Sheet1
.[a1].CurrentRegion.Offset(1).Clear
n = 1
For i = 1 To k
If br(i, 3) > 1 Then
n = n + 1
For j = 1 To 3
.Cells(n, j) = br(i, j)
Next j
.Hyperlinks.Add anchor:=.Cells(n, 2), Address:="", SubAddress:=br(n, 2), TextToDisplay:=br(n, 2)
End If
Next i
End With
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
|