|
Sub zhengli()
Dim d As Object
Dim ar As Variant, br As Variant
Set d = CreateObject("scripting.dictionary")
With Sheets("sheet1")
.[a1].CurrentRegion.Offset(1) = Empty
arr = .Range("a1:f50000")
For j = 1 To UBound(arr, 2)
If Trim(arr(1, j)) <> "" Then
d(Trim(arr(1, j))) = j
End If
Next j
n = 1
f = Dir(ThisWorkbook.Path & "\数据\*.xls*")
Do While f <> ""
Set wb = Workbooks.Open(ThisWorkbook.Path & "\数据\" & f, 0)
br = wb.Worksheets(1).[a1].CurrentRegion
For i = 2 To UBound(br)
If Trim(br(i, 1)) <> "" Then
n = n + 1
For j = 1 To UBound(br, 2)
m = d(Trim(br(1, j)))
If m <> "" Then
arr(n, m) = br(i, j)
End If
Next j
End If
Next i
wb.Close False
f = Dir
Loop
.[a1].Resize(n, UBound(arr, 2)) = arr
End With
End Sub
|
评分
-
1
查看全部评分
-
|