|
参与一下。。。
- Sub ykcbf() '//2024.7.24
- Set fso = CreateObject("scripting.filesystemobject")
- Set d = CreateObject("Scripting.Dictionary")
- Set reg = CreateObject("VBScript.Regexp")
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set sh = ThisWorkbook.Sheets("Org2")
- p = ThisWorkbook.path & ""
- With reg
- .Global = False
- .Pattern = "Read|CY|HQ|RFI"
- End With
- For Each f In fso.GetFolder(p).Files
- If LCase$(f.Name) Like "*.xls*" Then
- If InStr(f.Name, ThisWorkbook.Name) = 0 Then
- fn = fso.GetBaseName(f)
- If Not d.exists(fn) Then
- If Not reg.TEST(fn) Then
- d(fn) = ""
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets(1)
- r1 = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a2].Resize(r1 - 1, 23)
- End With
- wb.SaveAs p & fn & "-Read"
- wb.Close
- r = sh.Cells(Rows.Count, 1).End(3).Offset(1).Row
- sh.Cells(r, 1).Resize(UBound(arr), 23) = arr
- fso.deletefile f
- End If
- End If
- End If
- End If
- Next f
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|