|
Sub gj23w98()
Dim arr()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheet1.Range("c4:r" & Rows.Count).ClearContents
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "请选择需汇总的文件夹"
.Show
If .SelectedItems.Count = 0 Then
Exit Sub
Else
p = .SelectedItems(1) & "\"
End If
End With
f = Dir(p, vbDirectory)
Do While f <> ""
If f <> "." And f <> ".." Then
If (GetAttr(p & f) And vbDirectory) = vbDirectory Then
m = m + 1
ReDim Preserve arr(m)
arr(m) = p & f & "\"
End If
End If
f = Dir
Loop
For j = 1 To m
f = Dir(arr(j) & "*.xls")
While f <> ""
Set wb = CreateObject(arr(j) & f)
With wb.Sheets(1)
ar = .[c5:c65]
End With
Sheet1.Cells(5, 3 + n).Resize(61) = ar
Sheet1.Cells(4, 3 + n) = Replace(Split(Split(f, ".")(0), "-")(1), "表", "")
n = n + 1
wb.Close False
f = Dir()
Wend
Next
Set wb = Nothing
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
|
评分
-
2
查看全部评分
-
|