|
参与一下。。。- Sub 汇总() '//2024.12.23
- Application.ScreenUpdating = False
- Set d = 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
- d(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)
- m = m + 1
- For j = 1 To UBound(arr, 2)
- s = arr(2, j)
- If d.exists(s) Then
- brr(m, d(s)) = arr(i, j)
- End If
- Next
- 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
复制代码
|
|