|
Sub 录入表汇总()
Dim arr()
If MsgBox("是否确定汇总数据?", vbYesNo + vbInformation) = vbNo Then Exit Sub
Application.ScreenUpdating = False '//关闭屏幕刷新
Application.DisplayAlerts = False '//关闭系统提示
t = Timer '//开始时间
Sheet1.Range("e2:ca" & 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 & "*.xls*")
Do While f <> ""
Set wb = CreateObject(p & f)
With wb.Sheets("录入表")
ar = .[i3:i309]
End With
Sheet1.Cells(3, 5 + n).Resize(61) = ar
Sheet1.Cells(2, 5 + n) = Replace(Split(Split(f, ".")(0))(0), "FTTH", "")
n = n + 1
wb.Close False
f = Dir()
Loop
Set wb = Nothing
Application.ScreenUpdating = True '//恢复屏幕刷新
Application.DisplayAlerts = True '//恢复系统提示
MsgBox "一共用时:" & Format(Timer - t, "#0.0000") & " 秒共汇总了 " & n & " 个文件"
End Sub
|
评分
-
2
查看全部评分
-
|