|
- Sub 按钮1_Click()
- Set d = CreateObject("scripting.dictionary")
- Set fso = CreateObject("scripting.filesystemobject")
- arr = ThisWorkbook.Sheets(1).[a1].CurrentRegion
- ActiveSheet.UsedRange.Offset(1, 1).ClearContents
- Application.ScreenUpdating = False
- For j = 2 To UBound(arr)
- If Len(arr(j, 1)) > 0 Then d(arr(j, 1)) = j
- Next j
- c = 2
- For Each f In fso.getfolder(ThisWorkbook.Path).Files
- ThisWorkbook.Sheets(1).Cells(1, c) = Split(f.Name, ".")(0)
- arr = ThisWorkbook.Sheets(1).[a1].CurrentRegion
- If InStr(f.Name, ThisWorkbook.Name) = 0 Then
- With Workbooks.Open(f)
- brr = .Sheets(1).UsedRange
- .Close False
- End With
-
- For j = 3 To UBound(brr)
- If d.exists(brr(j, 2)) Then
- r = d(brr(j, 2))
- arr(r, c) = brr(j, 5)
- End If
- Next j
- c = c + 1
- ThisWorkbook.Sheets(1).[a1].CurrentRegion = arr
- End If
- Next
- ThisWorkbook.Sheets(1).[a1].CurrentRegion = arr
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|