|
Sub 汇总abc123()
Dim arr, brr(1 To 1000000, 1 To 3)
Dim wb As Workbook
Dim mypath$, myname$
Application.DisplayAlerts = False
Application.ScreenUpdating = False
mypath = ThisWorkbook.Path & "\数据\"
myname = Dir(mypath & "*.csv")
Do While myname <> ""
Set wb = GetObject(mypath & myname)
With wb
With .Worksheets(1)
r = .[a65536].End(3).Row
arr = .Range("a4:BL" & r)
For i = 1 To UBound(arr)
n = n + 1
brr(n, 1) = Split(wb.Name, ".")(0)
For j = 1 To UBound(arr, 2)
brr(n, 2) = arr(i, 1)
brr(n, 3) = arr(i, 21)
Next
Next
End With
.Close False
End With
myname = Dir()
Loop
With ThisWorkbook.Worksheets("汇总")
.[a2].Resize(n, 3) = brr
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "汇总完成!", vbInformation
End Sub
我想问下 这段代码提取的是A列和U列数据汇总。 我现在想提取A列到BL列所有数据(也是从第4行开始)应该怎么提取。
我原来想在brr(n, 3) = arr(i, 21)这个后面加 但是不行。。我看的懂这局是 C列的数据提取的是原来U列的数据 。
|
|