|
楼主 |
发表于 2023-3-7 18:36
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 一柱 于 2023-3-7 20:12 编辑
数值粘帖,或贴过去保持文本格式,我在这里加上这句好像不起作用,详见倒数第5行,红色字体,请教方法
Sub test()
Dim ar, br, i&, j&, r&, f, p$
Application.ScreenUpdating = False
With [A1].CurrentRegion
ar = .Resize(10 ^ 3)
r = .Rows.Count
End With
p = ThisWorkbook.Path & "\"
For Each f In CreateObject("Scripting.FileSystemObject").GetFolder(p).Files
If f.Name Like "*.xlsx" Then
With GetObject(f)
With .Sheets(1)
br = .[A1].CurrentRegion
For i = 3 To UBound(br)
If (br(i, 7) = "S202300108" Or br(i, 7) = "S202300109") And br(i, 10) = "20220225" Then
r = r + 1
For j = 1 To UBound(br, 2)
ar(r, j) = br(i, j)
Next j
End If
Next i
End With
.Close False
End With
End If
Next
[A1].Columns(1).NumberFormatLocal = "@"
[A1].Resize(r, UBound(ar, 2)) = ar
Application.ScreenUpdating = True
Beep
End Sub
|
|