|
结果未曾验证,不知道是否可行
- Sub 汇总()
- pth = ThisWorkbook.Path & ""
- f = Dir(pth & "*.xlsx")
- Set d = CreateObject("scripting.dictionary")
- Application.ScreenUpdating = False
- Do While f <> ""
- If f <> ThisWorkbook.Name Then
- Set wb = Workbooks.Open(f)
- With wb.Sheets(1)
- arr = .[b9].CurrentRegion
- For i = 3 To UBound(arr)
- y = arr(i, 1) & "," & arr(i, 2)
- d(y) = d(y) + arr(i, 4)
- Next
- End With
- wb.Close
- End If
- f = Dir
- Loop
- Application.ScreenUpdating = True
- ThisWorkbook.Worksheets(1).[a7].Resize(d.Count) = Application.Transpose(d.keys)
- ThisWorkbook.Worksheets(1).[a7].Resize(d.Count).TextToColumns comma:=True
- ThisWorkbook.Worksheets(1).[d7].Resize(d.Count) = Application.Transpose(d.items)
- End Sub
复制代码
|
|