|
- Sub text()
- Dim ws As Worksheet, arr, brr, i%, j%, m%, d, k
- Set d = CreateObject("scripting.dictionary")
- Application.ScreenUpdating = False
- For Each ws In Worksheets
- If ws.Name <> "目录" And InStr(ws.Name, "汇总") = 0 Then
- arr = ws.Range("A1").CurrentRegion
- For i = 2 To UBound(arr)
- d(arr(i, 2)) = ""
- Next
- d.Remove "学校"
- k = d.keys
- ReDim brr(1 To d.Count, 1 To UBound(arr, 2) - 3)
- ws.Range(ws.Cells(1, 5), ws.Cells(1, UBound(arr, 2))).Copy Worksheets(ws.Name & "汇总").Range("B2")
- For i = 0 To d.Count - 1
- brr(i + 1, 1) = k(i)
- For j = 2 To UBound(arr)
- If k(i) = arr(j, 2) Then
- For m = 5 To UBound(arr, 2)
- brr(i + 1, m - 3) = brr(i + 1, m - 3) + arr(j, m)
- Next
- End If
- Next
- Next
- Worksheets(ws.Name & "汇总").Range("A3").Resize(d.Count, UBound(arr, 2) - 3) = brr
- Worksheets(ws.Name & "汇总").UsedRange.Borders.LineStyle = xlContinuous
- Worksheets(ws.Name & "汇总").Columns("A:I").AutoFit
- End If
- d.RemoveAll
- Next
- Application.ScreenUpdating = True
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|