|
shpcb168 发表于 2020-9-19 15:18
可以的,另外部门也可以进行输入进行筛选。
好用记得评分哈...
Sub 查询()
Dim i, n, arr, brr(1 To 100, 1 To 3), sht As Worksheet, rng As Range
For Each sht In Worksheets
If sht.Name <> "汇总查询" Then
If sht.Name = [d4] & "部门" Then
arr = sht.[a1].CurrentRegion
For j = 3 To UBound(arr, 2)
If arr(2, j) = [d3] & "月" Then
For i = 3 To UBound(arr)
n = n + 1
brr(n, 1) = arr(i, 1)
brr(n, 2) = arr(i, j)
s = s + brr(n, 2)
Next
End If
Next
End If
End If
Next
For m = 1 To UBound(brr)
If brr(m, 1) <> "" Then brr(m, 3) = brr(m, 2) / s
Next
[c7].Resize(100, 3) = brr
Set rng = [c6:e100]
rng.Sort key1:="业绩", order1:=xlDescending, Header:=xlYes
End Sub
使用这个宏命令 |
|