|
参与一下。。。。
- Sub ykcbf() '//2024.4.10
- Set fso = CreateObject("scripting.filesystemobject")
- Application.ScreenUpdating = False
- Set sh = ThisWorkbook.Sheets("Sheet1")
- p = ThisWorkbook.Path & ""
- ReDim brr(1 To 1000000, 1 To 15)
- On Error Resume Next
- For Each f In fso.GetFolder(p).Files
- If LCase(f.Name) Like "*.txt" Then
- fn = fso.GetBaseName(f)
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets(1)
- zrr = .UsedRange
- wb.Close
- End With
- For i = 5 To UBound(zrr)
- st = WorksheetFunction.Trim(zrr(i, 1))
- If InStr(zrr(i, 1), "|--") = 0 Then
- b = Split(zrr(i, 1), "|")
- If b(2) <> Empty And InStr(b(4), "TO Number") = 0 Then
- m = m + 1
- For x = 1 To 15
- brr(m, x) = Trim(b(x))
- Next
- End If
- End If
- Next
- End If
- Next f
- With sh
- .UsedRange.Offset(1).Clear
- .Columns("a:o").NumberFormatLocal = "@"
- .[a2].Resize(m, 15) = brr
- .[a2].Resize(m, 15).Borders.LineStyle = 1
- .[a2].Resize(m, 15).Sort .[o2], 2
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|