|
- Sub dd()
- Dim d As Object, arr, brr, i&, j&, k&, s$
- Dim ws As Workbook, path$, dr$
- Application.ScreenUpdating = False
- Set d = CreateObject("scripting.dictionary")
- path = ThisWorkbook.path & ""
- dr = Dir(path & "*.xls")
- ReDim brr(1 To Cells.Rows.Count, 1 To 3)
- Do While dr <> ""
- If dr <> ThisWorkbook.Name Then
- Set ws = Workbooks.Open(path & dr)
- arr = [a1].CurrentRegion
- For i = 2 To UBound(arr)
- If arr(i, 8) = "True" Then
- n = 20
- Else
- n = 0
- End If
- If Not d.Exists(arr(i, 1)) Then
- k = k + 1
- d(arr(i, 1)) = k
- brr(k, 1) = arr(i, 1)
- brr(k, 2) = arr(i, 2)
- brr(k, 3) = n
- Else
- brr(d(arr(i, 1)), 3) = brr(d(arr(i, 1)), 3) + n
- End If
- Next
- ws.Close False
- End If
- dr = Dir
- Loop
- [a2].Resize(k, 3) = brr
- Set d = Nothing
- Application.ScreenUpdating = True
- End Sub
复制代码
|
|