|
参与一下。。。- Sub ykcbf() '//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, sh.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
- brr(m, 1) = m
- brr(m, 2) = s
- For j = 3 To UBound(arr, 2)
- s1 = arr(2, j)
- If d1.exists(s1) Then
- jj = d1(s1)
- End If
- brr(m, jj) = arr(i, j)
- Next
- Else
- r = d(s)
- For j = 3 To UBound(arr, 2)
- s1 = arr(2, j)
- If d1.exists(s1) Then
- jj = d1(s1)
- End If
- brr(r, jj) = brr(r, jj) + arr(i, j)
- 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
- Set d1 = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|