|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub L()
- Dim Mypath$, Myname$, str$, sht As Worksheet, i%, Arr(1 To 10000, 1 To 15), drow%, drow1%, Brr, k%, j%, d, mmax%
- mmax = 1: i = 1
- Set d = CreateObject("scripting.dictionary")
- On Error Resume Next
- sht = ThisWorkbook.Worksheets("sheet1")
- Mypath = ThisWorkbook.Path & ""
- Myname = Dir(Mypath & "*.xls")
- Application.ScreenUpdating = False
- Do While Myname <> ""
- If Myname <> ThisWorkbook.Name Then
- ' MsgBox Myname
- With GetObject(Mypath & Myname)
- With .Sheets(1)
- Arr(i, 2) = .Cells(4, 6).Value: Arr(i, 3) = .Cells(7, 6): Arr(i, 4) = .Cells(5, 6)
- Arr(i, 5) = .Cells(9, 6): Arr(i, 6) = .Cells(11, 6): Arr(i, 7) = .Cells(13, 3): Arr(i, 1) = i
- i = i + 1
- mmax = i
- End With
- .Close False
- End With
- End If
- Myname = Dir
- Loop
- With ThisWorkbook.Worksheets("sheet1")
- drow1 = .[a65526].End(3).Row
- Brr = .Range("a2:g" & drow1)
- For j = 1 To mmax
- d(Arr(j, 2)) = j
- Next
- For j = 1 To UBound(Brr)
- Debug.Print j & " " & "brr(j,2)= " & Brr(j, 2) & " " & d(Brr(j, 2))
- For k = 3 To UBound(Brr, 2)
- Brr(j, k) = Arr(d(Brr(j, 2)), k)
- Next
- Next
- .Cells(2, 1).Resize(UBound(Brr), UBound(Brr, 2)) = Brr
- End With
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|