|
- Sub Macro1()
- Dim wb As Workbook, mypath$, arr, i&, j&
- Application.ScreenUpdating = False
- arr = Sheet1.[a1:e8]
- mypath = ThisWorkbook.Path & ""
- x = Sheet1.[h1]
- For i = 1 To UBound(arr)
- If Application.CountA(Cells(i, 1).Resize(1, UBound(arr, 2))) = 0 Then GoTo line1
- Set wb = GetObject(mypath & Format(i, "00") & ".xls") '.xls可根据版本改为后缀名
- For j = 1 To UBound(arr, 2)
- If arr(i, j) <> "" Then arr(i, j) = wb.Sheets(1).Cells(arr(i, j), x)
- Next
- wb.Close 0
- line1:
- Next
- Sheet2.Activate
- Cells.ClearContents
- Range("a1").Resize(UBound(arr), UBound(arr, 2)) = arr
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|