|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 按钮1_Click()
Set d = CreateObject("scripting.dictionary")
arr = Sheets("工资汇总").UsedRange
For j = 3 To UBound(arr)
If Not d.exists(arr(j, 2)) Then
Set d(arr(j, 2)) = CreateObject("scripting.dictionary")
End If
d(arr(j, 2))(arr(j, 14)) = d(arr(j, 2))(arr(j, 14)) + 1
Next j
arr = Sheets("报表").[ax1].Resize(d.Count + 2, 4)
For j = 0 To d.Count - 1
k = d.keys()(j)
arr(j + 3, 1) = k
For i = 2 To 4
arr(j + 3, i) = d(k)(arr(2, i))
Next i
Next j
Sheets("报表").[ax1].Resize(d.Count + 2, 4) = arr
End Sub
|
|