|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下。。。
- Sub ykcbf() '//2024.1.5
- Dim arr, brr(1 To 10000, 1 To 5)
- Set Fso = CreateObject("scripting.filesystemobject")
- Application.ScreenUpdating = False
- Set sh = ThisWorkbook.Sheets("Sheet1")
- p = ThisWorkbook.Path & ""
- For Each f In Fso.GetFolder(p).Files
- If f.Name Like "*.xls*" Then
- If InStr(f.Name, ThisWorkbook.Name) = 0 Then
- Set Wb = Workbooks.Open(f, 0)
- With Wb.Sheets("基本信息&商品信息")
- arr = .UsedRange
- r = .Cells(Rows.Count, 1).End(3).Row
- p1 = .[d4]
- p2 = .[j2]
- Wb.Close False
- End With
- For i = 23 To UBound(arr)
- If Val(arr(i, 1)) Then
- m = m + 1
- brr(m, 1) = arr(i, 3)
- brr(m, 2) = p1
- brr(m, 3) = p2
- brr(m, 4) = arr(i, 5)
- brr(m, 5) = Val(arr(i, 7))
- End If
- Next
- End If
- End If
- Next f
- With sh
- .[a2:e10000] = ""
- .[a2].Resize(m, 5) = brr
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|