|
排重汇总。。。
- Sub 汇总() '//2024.12.23
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- Set sh = ThisWorkbook.Sheets("汇总表")
- With sh
- c1 = .UsedRange.Columns.Count
- ReDim brr(1 To 10000, 1 To c1)
- For j = 1 To c1
- s = .Cells(2, j).Value
- d1(s) = j
- Next
- End With
- On Error Resume Next
- For Each sht In Sheets
- If InStr("基本信息|汇总表|录入界面", sht.Name) = 0 Then
- With sht
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .UsedRange.Columns.Count
- arr = .[a1].Resize(r, c)
- For i = 3 To UBound(arr)
- s = arr(i, d1("推广者姓名"))
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- For j = 1 To UBound(arr, 2)
- s1 = arr(2, j)
- If d1.exists(s1) Then
- brr(m, d1(s1)) = arr(i, j)
- End If
- Next
- Else
- r = d(s)
- For j = 4 To UBound(arr, 2)
- s1 = arr(2, j)
- If InStr(LCase(s1), "id") = 0 Then
- If d1.exists(s1) Then
- If Val(arr(i, j)) Then
- brr(r, d1(s1)) = brr(r, d1(s1)) + arr(i, j)
- End If
- End If
- End If
- Next
- End If
- Next
- End With
- End If
- Next
- With sh
- .UsedRange.Offset(2).ClearContents
- .[a3].Resize(m, c1) = brr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|