|
虽然问题已经解决,但是练练手,来个GetOpenFilename的多选EXCEL写法,速度慢一些。
Sub TEST()
Application.ScreenUpdating = False
COST = Timer
Dim ARR, BRR
PATH1 = ThisWorkbook.Path
A = Application.GetOpenFilename("EXCEL文件,*.XLS*", MultiSelect:=True) '允许多选
If IsArray(A) Then
ReDim BRR(1 To 65500, 1 To 5)
J = 1
For I = LBound(A) To UBound(A)
Workbooks.Open (A(I))
r = ActiveWorkbook.Sheets("SHEET1").Range("A65500").End(3).Row
ARR = Range("B" & r - 4 & ":B" & r)
ActiveWorkbook.Close False '关闭日期表后会转回原表
For II = 1 To 5
BRR(J, II) = ARR(II, 1)
Next
J = J + 1
Next
Else
MsgBox "END"
End If
Range("C2").Resize(J, 5) = BRR
Application.ScreenUpdating = True
MsgBox Format(Timer - COST, "0.0000秒"), , "用时:"
End Sub |
|