|
Sub qs()
Application.ScreenUpdating = False
Dim arr, i, wb As Workbook, xb As Workbook
Dim FileName
FileName = Application.GetOpenFilename(FileFilter:="Excel 工作簿文件 (*.xls*),*.xls*", Title:="请选择文件", MultiSelect:=True)
If Not IsArray(FileName) Then
MsgBox "没有选择文件"
Exit Sub
End If
For Each f In FileName
Set xb = Workbooks.Open(f, 0)
rw = xb.Sheets(1).Cells(Rows.Count, "d").End(3).Row
arr = xb.Sheets(1).Range("d2:i" & rw).Value
xb.Close (0)
For i = 2 To 3
Sheet1.Cells(2, i).Resize(UBound(arr), 1) = Application.Index(arr, 0, i + 3)
Sheet1.Cells(2, i + 4).Resize(UBound(arr), 1) = Application.Index(arr, 0, i + 3)
Next
Next f
Application.ScreenUpdating = True
End Sub
|
|