|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub hz()
Application.ScreenUpdating = False
Dim ar As Variant
Dim d As Object
Set d = CreateObject("scripting.dictionary")
With Sheets("TA")
r = .Cells(Rows.Count, 1).End(xlUp).Row
If r < 4 Then MsgBox "TA为空!": End
ar = .Range("a3:r" & r)
End With
Dim br()
ReDim br(1 To UBound(ar), 1 To 6)
For i = 2 To UBound(ar)
zd = ar(i, 4) & "|" & ar(i, 5) & "|" & ar(i, 6) & "|" & ar(i, 8)
t = d(zd)
If t = "" Then
k = k + 1
d(zd) = k
t = k
br(k, 1) = ar(i, 4)
br(k, 2) = ar(i, 5)
br(k, 3) = ar(i, 6)
br(k, 4) = ar(i, 8)
End If
br(t, 5) = br(t, 5) + 1
br(t, 6) = br(t, 5) / 15
Next i
With Sheets("Sheet1")
.[a1].CurrentRegion.Offset(1) = Empty
.[a2].Resize(k, UBound(br, 2)) = br
End With
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
|